clever-tools icon indicating copy to clipboard operation
clever-tools copied to clipboard

Support `--format` for all commands

Open hsablonniere opened this issue 2 years ago • 4 comments

  • default is human readable (--format=human)
  • This is the one with tables, colors, indentation...
  • --format=json for most commands
  • --format=[FOO] for specific formats
    • example clever addon env --format=bash

hsablonniere avatar Jul 18 '23 14:07 hsablonniere

For our JSON keys we currently use a lowerCamelCase

aurrelhebert avatar Mar 12 '24 10:03 aurrelhebert

remaining commands:

  • [ ] activity
  • [ ] config
  • [ ] diag
  • [ ] drain
  • [ ] env
  • [ ] notify-email
  • [ ] profile
  • [ ] published-configs
  • [ ] service
  • [ ] status
  • [ ] tcp-redirs
  • [ ] webhooks

pdesoyres-cc avatar Apr 23 '24 07:04 pdesoyres-cc

some commands support the --json/-j option. For them, we should make a smooth transition to --format/-F option. We may support both, but one day, we will remove the --json/-j option:

  • [ ] applications
  • [ ] ng / networkgroups

pdesoyres-cc avatar Apr 25 '24 12:04 pdesoyres-cc

About json format and follow behavior.

In some commands, we can follow. for instance in log command when no since is specified. or in activity command.

In log command, there is json-stream format. In activity command, the json format is not yet supported.

I propose to get rid of json-stream format and simplify into:

command doesn't imply follow, format is human:

output line 1
output line 2

command doesn't imply follow, format is json:

[
	{"output": "line 1"},
	{"output": "line 2"}
]

command implies follow, format is human:

output line 1
output line 2
...

command implies follow, format is json:

{"output": "line 1"}
{"output": "line 2"}
...

pdesoyres-cc avatar Apr 25 '24 12:04 pdesoyres-cc