Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions cli/command/system/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,16 @@ var placeHolders = regexp.MustCompile(`\.[a-zA-Z]`)
// connecting to the daemon. This allows (e.g.) to only get cli-plugin
// information, without also making a (potentially expensive) API call.
func needsServerInfo(template string, info dockerInfo) bool {
if len(template) == 0 || placeHolders.FindString(template) == "" {
// The template is empty, or does not contain formatting fields
// (e.g. `table` or `raw` or `{{ json .}}`). Assume we need server-side
// information to render it.
switch template {
case "", formatter.JSONFormat, formatter.JSONFormatKey:
// No format (default) and full JSON output need server-side info.
return true
default:
if placeHolders.FindString(template) == "" {
// The template does not contain formatting fields; assume we
// need server-side information to render it, and return early.
return true
}
}

// A template is provided and has at least one field set.
Expand Down
Loading