-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement the -q or --quiet flag to add with minimal output #372
Conversation
5a50cad
to
cfab643
Compare
Ooops, I had not checked that the go tests still passed. It should be ok now 😄 |
if quietOpt != nil && quietOpt.Definition() == cmds.OptionQuietOutput { | ||
quiet, _, err = quietOpt.Bool() | ||
if err != nil { | ||
return nil, nil, nil, u.ErrCast() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the Request instance was already successfully initialized, we need to still return it:
return req, nil, nil, u.ErrCast()
(see #378)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you are right, I will fix that.
cfab643
to
c7fe55b
Compare
Great! Though-- at first pass I think this can be implemented without changing the While the // within the cmd's Run func:
quiet, _, err := req.Option("quiet").Bool() // [2]
if err != nil {
return nil, err
} [1] I'd like to avoid adding more complexity into the request + parsing-- though if we determine it really should be this way, let's do it. I just don't see it yet. |
Ok, I will have another look at this. |
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
c7fe55b
to
aca62a4
Compare
@jbenet the new version uses the code you suggested and it accepts both --quiet and -q |
@chriscool awesome, thanks! LGTM! (btw, i'm fine with adding static options (like a dedicated quiet option, that works the same way), just want to avoid adding complexity to the NewRequest, etc. we can always just add it the next time we add a quiet flag. |
Implement the -q or --quiet flag to add with minimal output
This implements issue #304.
It was done as much as possible in the same way as the
-r or --recursive flag.
License: MIT
Signed-off-by: Christian Couder chriscool@tuxfamily.org