Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default CLI to indent mode #2607

Closed
cwgoes opened this issue Oct 26, 2018 · 4 comments
Closed

Default CLI to indent mode #2607

cwgoes opened this issue Oct 26, 2018 · 4 comments

Comments

@cwgoes
Copy link
Contributor

cwgoes commented Oct 26, 2018

It's easy for automated scripts who don't want indentation to disable it with a flag, but annoying for users to have to pass a flag every time they want a readable response.

@jackzampolin
Copy link
Member

Another thing to check here is to ensure that all commands that output JSON have the --indent flag wired up.

@alexanderbez
Copy link
Contributor

Something to keep in mind, many commands use queriers which JSON serialize and return the byte slice response. That is then fed directly to output in the command. To respect the indent flag in these cases, you'll have to deserialize and then re-serialize once again (correct me if I'm wrong).

@jackzampolin
Copy link
Member

@alexanderbez Yeah, the cliCtx.QueryWithData function returns bytes. There a couple of different ways this is done in the CLI right now. Look at gov, stake, and auth for 3 different methods. I think the work here would be to audit all the CLI methods and find the best way of doing this.

@alessio
Copy link
Contributor

alessio commented Jan 22, 2019

It's easy for automated scripts who don't want indentation to disable it with a flag, but annoying for users to have to pass a flag every time they want a readable response.

To put it differently, it's easy for user to set indent = true in ~/.gaiacli/config/config.toml

alessio pushed a commit that referenced this issue Jan 22, 2019
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
cwgoes pushed a commit that referenced this issue Jan 22, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants