From cc03bea37be375f0467a00113361982f68c23274 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 22 Jan 2019 03:32:36 +0000 Subject: [PATCH] make gaiacli config handle "indent" flag It defaults to false, users can override it via gaiacli config and avoid to append --indent to all commands: $ gaiacli config indent true Closes: #2607 --- PENDING.md | 1 + client/config.go | 4 ++-- cmd/gaia/cli_test/cli_test.go | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PENDING.md b/PENDING.md index 5b9941d8efba..4927bfc54b78 100644 --- a/PENDING.md +++ b/PENDING.md @@ -64,6 +64,7 @@ FEATURES * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) New `multisign` command to generate multisig signatures. * [\#3198](https://github.com/cosmos/cosmos-sdk/issues/3198) New `sign --multisig` flag to enable multisig mode. * [\#2715](https://github.com/cosmos/cosmos-sdk/issues/2715) Reintroduce gaia server's insecure mode. + * [\#2607](https://github.com/cosmos/cosmos-sdk/issues/2607) Make `gaiacli config` handle the boolean `indent` flag to beautify commands JSON output. * Gaia * [\#2182] [x/staking] Added querier for querying a single redelegation diff --git a/client/config.go b/client/config.go index 90707b78548c..675a35296a62 100644 --- a/client/config.go +++ b/client/config.go @@ -78,7 +78,7 @@ func runConfigCmd(cmd *cobra.Command, args []string) error { // Get value action if getAction { switch key { - case "trace", "trust-node": + case "trace", "trust-node", "indent": fmt.Println(tree.GetDefault(key, false).(bool)) default: if defaultValue, ok := configDefaults[key]; ok { @@ -98,7 +98,7 @@ func runConfigCmd(cmd *cobra.Command, args []string) error { switch key { case "chain-id", "output", "node": tree.Set(key, value) - case "trace", "trust-node": + case "trace", "trust-node", "indent": boolVal, err := strconv.ParseBool(value) if err != nil { return err diff --git a/cmd/gaia/cli_test/cli_test.go b/cmd/gaia/cli_test/cli_test.go index 6b644840599b..2fb00d4b6532 100644 --- a/cmd/gaia/cli_test/cli_test.go +++ b/cmd/gaia/cli_test/cli_test.go @@ -880,10 +880,12 @@ func TestGaiaCLIConfig(t *testing.T) { f.CLIConfig("trust-node", "true") f.CLIConfig("chain-id", f.ChainID) f.CLIConfig("trace", "false") + f.CLIConfig("indent", "true") config, err := ioutil.ReadFile(path.Join(f.GCLIHome, "config", "config.toml")) require.NoError(t, err) expectedConfig := fmt.Sprintf(`chain-id = "%s" +indent = true node = "%s" output = "text" trace = false