-
Notifications
You must be signed in to change notification settings - Fork 53
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
Initialize logging with default info #648
Conversation
On C-S-T after applying this diff.
Run c-s-t
|
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.
@tejal29 thanks for looking into this one. Can we also display the usage when someone provides an invalid flag? This will make it easier for them to figure out what flag they actually want, and save them the time of typing the help
command.
Working around the bug in cobra spf13/cobra#340 where RunE always displays usage. |
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.
one nit but otherwise LGTM
ctb.AddFlags() | ||
ctb.AddSubCommands() | ||
} | ||
|
||
func (ctb *ContainerToolCommandBase) SetSilenceUsage() { | ||
// Donot display usage when using RunE after args are parsed. |
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.
nit: s/"Donot"/"Do not"
In c-s-t we are seeing errors https://github.com/GoogleContainerTools//issues/135
This is because, we --image is not a valid arg for root command container_structure_test. The conbra.OnInitialize registered function initLogging is only called when the command is parsed correctly.
Hence, this diff initialize the logging with info log level.