Skip to content

Commit 1e89037

Browse files
committed
cli/command/system: prettyInfo: 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 8cfefc6 commit 1e89037

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

cli/command/system/info.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,29 +160,29 @@ func needsServerInfo(template string, info info) bool {
160160
return err != nil
161161
}
162162

163-
func prettyPrintInfo(dockerCli command.Cli, info info) error {
163+
func prettyPrintInfo(streams command.Streams, info info) error {
164164
// Only append the platform info if it's not empty, to prevent printing a trailing space.
165165
if p := info.clientPlatform(); p != "" {
166-
_, _ = fmt.Fprintln(dockerCli.Out(), "Client:", p)
166+
_, _ = fmt.Fprintln(streams.Out(), "Client:", p)
167167
} else {
168-
_, _ = fmt.Fprintln(dockerCli.Out(), "Client:")
168+
_, _ = fmt.Fprintln(streams.Out(), "Client:")
169169
}
170170
if info.ClientInfo != nil {
171-
prettyPrintClientInfo(dockerCli, *info.ClientInfo)
171+
prettyPrintClientInfo(streams, *info.ClientInfo)
172172
}
173173
for _, err := range info.ClientErrors {
174-
fmt.Fprintln(dockerCli.Err(), "ERROR:", err)
174+
fmt.Fprintln(streams.Err(), "ERROR:", err)
175175
}
176176

177-
fmt.Fprintln(dockerCli.Out())
178-
fmt.Fprintln(dockerCli.Out(), "Server:")
177+
fmt.Fprintln(streams.Out())
178+
fmt.Fprintln(streams.Out(), "Server:")
179179
if info.Info != nil {
180-
for _, err := range prettyPrintServerInfo(dockerCli, &info) {
180+
for _, err := range prettyPrintServerInfo(streams, &info) {
181181
info.ServerErrors = append(info.ServerErrors, err.Error())
182182
}
183183
}
184184
for _, err := range info.ServerErrors {
185-
fmt.Fprintln(dockerCli.Err(), "ERROR:", err)
185+
fmt.Fprintln(streams.Err(), "ERROR:", err)
186186
}
187187

188188
if len(info.ServerErrors) > 0 || len(info.ClientErrors) > 0 {

0 commit comments

Comments
 (0)