mirror of https://github.com/docker/cli.git
cli/command/system/runInfo: set negotiated API version when available
The current logic was ignoring (e.g.) `--format=json` formats, and was only setting the negotiated API version if no format was specified. While we do want to avoid calling the API if possible, we do already check if the given template requires a server connection, so let's move updating the API version to that block. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ce22ac2736
commit
223d71a837
|
@ -111,11 +111,11 @@ func runInfo(cmd *cobra.Command, dockerCli command.Cli, opts *infoOptions) error
|
|||
fprintln(dockerCli.Err(), err)
|
||||
}
|
||||
}
|
||||
info.ClientInfo.APIVersion = dockerCli.CurrentVersion()
|
||||
}
|
||||
|
||||
if opts.format == "" {
|
||||
info.UserName = dockerCli.ConfigFile().AuthConfigs[registry.IndexServer].Username
|
||||
info.ClientInfo.APIVersion = dockerCli.CurrentVersion()
|
||||
return prettyPrintInfo(dockerCli, info)
|
||||
}
|
||||
return formatInfo(dockerCli.Out(), info, opts.format)
|
||||
|
|
Loading…
Reference in New Issue