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:
parent
cffa39cf44
commit
b055c129dd
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user