Skip to content

Commit

Permalink
make gaiacli config handle "indent" flag
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Alessio Treglia committed Jan 22, 2019
1 parent 7f789d2 commit cc03bea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions cmd/gaia/cli_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc03bea

Please sign in to comment.