MCPcopy Index your code
hub / github.com/docker/cli / prettyPrintInfo

Function prettyPrintInfo

cli/command/system/info.go:188–215  ·  view source on GitHub ↗
(streams command.Streams, info dockerInfo)

Source from the content-addressed store, hash-verified

186}
187
188func prettyPrintInfo(streams command.Streams, info dockerInfo) error {
189 // Only append the platform info if it's not empty, to prevent printing a trailing space.
190 if p := info.clientPlatform(); p != "" {
191 fprintln(streams.Out(), "Client:", p)
192 } else {
193 fprintln(streams.Out(), "Client:")
194 }
195 if info.ClientInfo != nil {
196 prettyPrintClientInfo(streams, *info.ClientInfo)
197 }
198 for _, err := range info.ClientErrors {
199 fprintln(streams.Err(), "ERROR:", err)
200 }
201
202 fprintln(streams.Out())
203 fprintln(streams.Out(), "Server:")
204 if info.Info != nil {
205 prettyPrintServerInfo(streams, &info)
206 }
207 for _, err := range info.ServerErrors {
208 fprintln(streams.Err(), "ERROR:", err)
209 }
210
211 if len(info.ServerErrors) > 0 || len(info.ClientErrors) > 0 {
212 return errors.New("errors pretty printing info")
213 }
214 return nil
215}
216
217func prettyPrintClientInfo(streams command.Streams, info clientInfo) {
218 fprintlnNonEmpty(streams.Out(), " Version: ", info.Version)

Callers 3

TestPrettyPrintInfoFunction · 0.85
BenchmarkPrettyPrintInfoFunction · 0.85
runInfoFunction · 0.85

Calls 6

fprintlnFunction · 0.85
prettyPrintClientInfoFunction · 0.85
prettyPrintServerInfoFunction · 0.85
clientPlatformMethod · 0.80
OutMethod · 0.65
ErrMethod · 0.65

Tested by 2

TestPrettyPrintInfoFunction · 0.68
BenchmarkPrettyPrintInfoFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…