aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@gmail.com>2017-04-28 18:38:49 +0800
committerBas van Kervel <basvankervel@gmail.com>2017-04-28 20:01:54 +0800
commitf6c0f76cc56e98ac564dd523569b03468a387ef7 (patch)
treea516a68d267950b4237e8f70bafb08ebbbdff768 /cmd/utils/flags.go
parentf9be9a2302dd73fe3cc792167d65f24c7b7d35c4 (diff)
downloaddexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.tar
dexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.tar.gz
dexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.tar.bz2
dexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.tar.lz
dexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.tar.xz
dexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.tar.zst
dexon-f6c0f76cc56e98ac564dd523569b03468a387ef7.zip
cmd/geth: reorganise account/wallet command/flags
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index e9b0d86a4..9e80bba60 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -647,7 +647,7 @@ func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) {
}
}
-// MakePasswordList reads password lines from the file specified by --password.
+// MakePasswordList reads password lines from the file specified by the global --password flag.
func MakePasswordList(ctx *cli.Context) []string {
path := ctx.GlobalString(PasswordFileFlag.Name)
if path == "" {
@@ -979,3 +979,27 @@ func MakeConsolePreloads(ctx *cli.Context) []string {
}
return preloads
}
+
+// MigrateFlags sets the global flag from a local flag when it's set.
+// This is a temporary function used for migrating old command/flags to the
+// new format.
+//
+// e.g. geth account new --keystore /tmp/mykeystore --lightkdf
+//
+// is equivalent after calling this method with:
+//
+// geth --keystore /tmp/mykeystore --lightkdf account new
+//
+// This allows the use of the existing configuration functionality.
+// When all flags are migrated this function can be removed and the existing
+// configuration functionality must be changed that is uses local flags
+func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error {
+ return func(ctx *cli.Context) error {
+ for _, name := range ctx.FlagNames() {
+ if ctx.IsSet(name) {
+ ctx.GlobalSet(name, ctx.String(name))
+ }
+ }
+ return action(ctx)
+ }
+}