mirror of https://github.com/docker/cli.git
cli/command/system: prettyPrintClientInfo: accept Streams
No need to pass whole of DockerCLI, as all it needs is the outputs. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
73938cd618
commit
ba7a200f0a
|
@ -191,18 +191,19 @@ func prettyPrintInfo(dockerCli command.Cli, info info) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func prettyPrintClientInfo(dockerCli command.Cli, info clientInfo) {
|
func prettyPrintClientInfo(streams command.Streams, info clientInfo) {
|
||||||
fprintlnNonEmpty(dockerCli.Out(), " Version: ", info.Version)
|
output := streams.Out()
|
||||||
fmt.Fprintln(dockerCli.Out(), " Context: ", info.Context)
|
fprintlnNonEmpty(output, " Version: ", info.Version)
|
||||||
fmt.Fprintln(dockerCli.Out(), " Debug Mode:", info.Debug)
|
fmt.Fprintln(output, " Context: ", info.Context)
|
||||||
|
fmt.Fprintln(output, " Debug Mode:", info.Debug)
|
||||||
|
|
||||||
if len(info.Plugins) > 0 {
|
if len(info.Plugins) > 0 {
|
||||||
fmt.Fprintln(dockerCli.Out(), " Plugins:")
|
fmt.Fprintln(output, " Plugins:")
|
||||||
for _, p := range info.Plugins {
|
for _, p := range info.Plugins {
|
||||||
if p.Err == nil {
|
if p.Err == nil {
|
||||||
fmt.Fprintf(dockerCli.Out(), " %s: %s (%s)\n", p.Name, p.ShortDescription, p.Vendor)
|
fmt.Fprintf(output, " %s: %s (%s)\n", p.Name, p.ShortDescription, p.Vendor)
|
||||||
fprintlnNonEmpty(dockerCli.Out(), " Version: ", p.Version)
|
fprintlnNonEmpty(output, " Version: ", p.Version)
|
||||||
fprintlnNonEmpty(dockerCli.Out(), " Path: ", p.Path)
|
fprintlnNonEmpty(output, " Path: ", p.Path)
|
||||||
} else {
|
} else {
|
||||||
info.Warnings = append(info.Warnings, fmt.Sprintf("WARNING: Plugin %q is not valid: %s", p.Path, p.Err))
|
info.Warnings = append(info.Warnings, fmt.Sprintf("WARNING: Plugin %q is not valid: %s", p.Path, p.Err))
|
||||||
}
|
}
|
||||||
|
@ -210,7 +211,7 @@ func prettyPrintClientInfo(dockerCli command.Cli, info clientInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(info.Warnings) > 0 {
|
if len(info.Warnings) > 0 {
|
||||||
fmt.Fprintln(dockerCli.Err(), strings.Join(info.Warnings, "\n"))
|
fmt.Fprintln(streams.Err(), strings.Join(info.Warnings, "\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue