DescriptionAdd standard functions for command output.
Add simple function support and flags around changing how the command output
works by default. Add flag options for '-q' and '--quiet', and provider a
short '-d' for '--debug'. Also updated the text for the flags.
There are now two methods in the cmd package that should be used for output:
cmd.Infof(...)
and
cmd.Verbosef(...)
If quiet is specified, both are logged instead of written out. If verbose is
specified, both are written out, if the defaults are used, Info is written
out, but verbose is logged.
Ideally I'd like to tweak loggo so we can specify the call depth of the
caller, so we can grab the appropriate line numbers etc, but this can happen
later. Also, now any use of these methods will have the 'juju.cmd' module. Not
sure if we want to really parameterize that.
The only thing I'm wondering about is Stderr vs. Stdout. Ideally I'd prefer
to use Stdout where possible, but for the format oriented commands, we still
want users to be able to go:
'juju status --format=json | other-thing'
So we don't want to polute Stdout in those situations with output.
There are a number of options here:
* we just write to Stdout, and have people add '-q'
* we write the info and verbose info to Stderr so it just works
Then do we have some go to Stdout and some Stderr?
Logging now goes to Stderr, so we could just send all output there (except for
the actual formatted output).
https://code.launchpad.net/~thumper/juju-core/default-command-info/+merge/194061
(do not edit description out of merge proposal)
Patch Set 1 #
Total comments: 1
Patch Set 2 : Add standard functions for command output. #
Total comments: 1
MessagesTotal messages: 10
|