-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add output mechanism for CLI commands #29
Conversation
Perfectly fine. Both were just another outcome of my cmd-structure PR. Also,
I like the decision. Now that we have a Like this:
|
why would each command have a different output format? |
If we take That being said, after building out the subcommands a bit more, if we notice they'll all supporting the same |
I'm good with that 👍 |
Part of #3
This PR adds an output mechanism for CLI commands.
We had
opt/
andoutput/
in place but I felt they were not going to be flexible enough to handle all possible printers, and things likeHandleString
belonged in a logger abstraction.This adds an
OutputFormat
class which should be scoped to a subcommand and accepts a list of printers, it then configures the flags, handles validation, and passing along the object to the correct printer.This style of
--output
is very similar to kubectl. By doing it like this we will be able to fairly easily handle output formats which allow multiple flags e.g..Decisions made:
cmd/
go code intopkg/
--output yaml
rather than--yaml
, matching kubectlcc @voigt since you've made modifications in this code previously