diff --git a/covenant-signer/cmd/helper.go b/covenant-signer/cmd/helper.go index b185464..7ed1ace 100644 --- a/covenant-signer/cmd/helper.go +++ b/covenant-signer/cmd/helper.go @@ -10,9 +10,6 @@ import ( "github.com/spf13/cobra" ) -// PersistClientCtx persist some vars from the cmd or config to the client context. -// It gives preferences to flags over the values in the config. If the flag is not set -// and exists a value in the config that could be used, it will be set in the ctx. func PersistClientCtx(ctx client.Context) func(cmd *cobra.Command, _ []string) error { return func(cmd *cobra.Command, _ []string) error { encCfg := params.DefaultEncodingConfig() diff --git a/covenant-signer/cmd/root.go b/covenant-signer/cmd/root.go index ed24b0c..468018d 100644 --- a/covenant-signer/cmd/root.go +++ b/covenant-signer/cmd/root.go @@ -5,6 +5,7 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" ) @@ -16,8 +17,8 @@ var ( // C:\Users\\AppData\Local\signer on Windows // ~/.signer on Linux // ~/Library/Application Support/signer on MacOS - dafaultConfigDir = btcutil.AppDataDir("signer", false) - dafaultConfigPath = filepath.Join(dafaultConfigDir, "config.toml") + defaultConfigDir = btcutil.AppDataDir("signer", false) + defaultConfigPath = filepath.Join(defaultConfigDir, "config.toml") rootCmd = NewRootCmd() ) @@ -31,6 +32,7 @@ func NewRootCmd() *cobra.Command { PersistentPreRunE: PersistClientCtx(client.Context{}), } + cmd.PersistentFlags().String(flags.FlagHome, defaultConfigDir, "The application home directory") return cmd } @@ -43,7 +45,7 @@ func init() { rootCmd.PersistentFlags().StringVar( &configPath, configPathKey, - dafaultConfigPath, + defaultConfigPath, "path to the configuration file", ) }