Merge PR #3442: 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
This commit is contained in:
Alessio Treglia 2019-01-22 11:07:18 +01:00 committed by Christopher Goes
parent cffa39cf44
commit b055c129dd
3 changed files with 5 additions and 2 deletions

View File

@ -65,6 +65,7 @@ FEATURES
* [\#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.
* [\#3334](https://github.com/cosmos/cosmos-sdk/pull/3334) New `gaiad completion` and `gaiacli completion` to generate Bash/Zsh completion scripts.
* [\#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

View File

@ -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

View File

@ -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