Skip to content

Commit ba7a200

Browse files
committed
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>
1 parent 73938cd commit ba7a200

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

cli/command/system/info.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,27 @@ func prettyPrintInfo(dockerCli command.Cli, info info) error {
191191
return nil
192192
}
193193

194-
func prettyPrintClientInfo(dockerCli command.Cli, info clientInfo) {
195-
fprintlnNonEmpty(dockerCli.Out(), " Version: ", info.Version)
196-
fmt.Fprintln(dockerCli.Out(), " Context: ", info.Context)
197-
fmt.Fprintln(dockerCli.Out(), " Debug Mode:", info.Debug)
194+
func prettyPrintClientInfo(streams command.Streams, info clientInfo) {
195+
output := streams.Out()
196+
fprintlnNonEmpty(output, " Version: ", info.Version)
197+
fmt.Fprintln(output, " Context: ", info.Context)
198+
fmt.Fprintln(output, " Debug Mode:", info.Debug)
198199

199200
if len(info.Plugins) > 0 {
200-
fmt.Fprintln(dockerCli.Out(), " Plugins:")
201+
fmt.Fprintln(output, " Plugins:")
201202
for _, p := range info.Plugins {
202203
if p.Err == nil {
203-
fmt.Fprintf(dockerCli.Out(), " %s: %s (%s)\n", p.Name, p.ShortDescription, p.Vendor)
204-
fprintlnNonEmpty(dockerCli.Out(), " Version: ", p.Version)
205-
fprintlnNonEmpty(dockerCli.Out(), " Path: ", p.Path)
204+
fmt.Fprintf(output, " %s: %s (%s)\n", p.Name, p.ShortDescription, p.Vendor)
205+
fprintlnNonEmpty(output, " Version: ", p.Version)
206+
fprintlnNonEmpty(output, " Path: ", p.Path)
206207
} else {
207208
info.Warnings = append(info.Warnings, fmt.Sprintf("WARNING: Plugin %q is not valid: %s", p.Path, p.Err))
208209
}
209210
}
210211
}
211212

212213
if len(info.Warnings) > 0 {
213-
fmt.Fprintln(dockerCli.Err(), strings.Join(info.Warnings, "\n"))
214+
fmt.Fprintln(streams.Err(), strings.Join(info.Warnings, "\n"))
214215
}
215216
}
216217

0 commit comments

Comments
 (0)