File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,11 +149,16 @@ var placeHolders = regexp.MustCompile(`\.[a-zA-Z]`)
149149// connecting to the daemon. This allows (e.g.) to only get cli-plugin
150150// information, without also making a (potentially expensive) API call.
151151func needsServerInfo (template string , info dockerInfo ) bool {
152- if len (template ) == 0 || placeHolders .FindString (template ) == "" {
153- // The template is empty, or does not contain formatting fields
154- // (e.g. `table` or `raw` or `{{ json .}}`). Assume we need server-side
155- // information to render it.
152+ switch template {
153+ case "" , formatter .JSONFormat , formatter .JSONFormatKey :
154+ // No format (default) and full JSON output need server-side info.
156155 return true
156+ default :
157+ if placeHolders .FindString (template ) == "" {
158+ // The template does not contain formatting fields; assume we
159+ // need server-side information to render it, and return early.
160+ return true
161+ }
157162 }
158163
159164 // A template is provided and has at least one field set.
You can’t perform that action at this time.
0 commit comments