-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: make printing output easier (approach 1)
I'm looking if we can make printing output easier, and without linters warning about all the unhandled errors for `fmt.FPrintXX()`. One approach could be to use Cobra's print functions, which are convenient, but the (big!) downside is that we would then have to pass _both_ `cobra.Command` _and_ `command.Cli` everywhere. Looking at our code, it looks like the intent is to separate functionality from cobra (cobra "triggers" the command, but the command itself is agnostic to being called from cobra). The other approach is to - enhance the CLI to have utilities for printing (similar to cobra); `dockerCli.Printf(...)` - enhance the `streams` package to have utilities, but note that while both `dockerCli.Out()` and `dockerCli.Err()` are an `io.Writer`, only `dockerCli.Out()` is a `streams.Out`, so we would have to change `dockerCli.Err()` to also be a `streams.Out`. Maybe there was a reason for not doing so (`streams.Out` can detect if a terminal is attached, maybe that's not possible for `STDERR`, which (unlike `STDOUT` is not buffered? not sure if that makes a difference) Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information
Showing
3 changed files
with
17 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters