Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12)

Issue 22320043: Add standard functions for command output.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 6 months ago by thumper
Modified:
10 years, 1 month ago
Reviewers:
wallyworld, jameinel, fwereade, mp+194061
Visibility:
Public.

Description

Add 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
Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -37 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/cmd.go View 1 1 chunk +34 lines, -4 lines 1 comment Download
M cmd/juju/deploy.go View 1 2 chunks +2 lines, -3 lines 0 comments Download
M cmd/logging.go View 1 3 chunks +25 lines, -18 lines 0 comments Download
M cmd/logging_test.go View 1 5 chunks +88 lines, -12 lines 0 comments Download

Messages

Total messages: 10
thumper
Please take a look.
10 years, 6 months ago (2013-11-06 04:04:42 UTC) #1
wallyworld
A few questions. 1. -d for debug is sorta bad There's a number of existing ...
10 years, 6 months ago (2013-11-06 04:31:25 UTC) #2
fwereade
On 2013/11/06 04:04:42, thumper wrote: > Please take a look. I'm sure we want to ...
10 years, 6 months ago (2013-11-06 10:44:31 UTC) #3
jameinel
We have a cmd.Context object which is passed to all the commands, and is something ...
10 years, 6 months ago (2013-11-06 11:45:34 UTC) #4
fwereade
On 2013/11/06 11:45:34, jameinel wrote: > We have a cmd.Context object which is passed to ...
10 years, 6 months ago (2013-11-07 14:45:41 UTC) #5
thumper
Please take a look.
10 years, 1 month ago (2014-03-26 00:48:18 UTC) #6
thumper
On 2013/11/06 04:31:25, wallyworld wrote: > A few questions. > > 1. -d for debug ...
10 years, 1 month ago (2014-03-26 00:53:04 UTC) #7
thumper
On 2013/11/06 10:44:31, fwereade wrote: > On 2013/11/06 04:04:42, thumper wrote: > > Please take ...
10 years, 1 month ago (2014-03-26 00:53:19 UTC) #8
thumper
On 2013/11/06 11:45:34, jameinel wrote: > We have a cmd.Context object which is passed to ...
10 years, 1 month ago (2014-03-26 00:54:10 UTC) #9
wallyworld
10 years, 1 month ago (2014-03-26 01:07:18 UTC) #10
LGTM

https://codereview.appspot.com/22320043/diff/20001/cmd/cmd.go
File cmd/cmd.go (right):

https://codereview.appspot.com/22320043/diff/20001/cmd/cmd.go#newcode110
cmd/cmd.go:110: // the logger if we are.
....?
Doesn't quite parse
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b