From e3b58d302795fbbfa6c117774906a4c9efd536f4 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 30 Aug 2013 00:46:43 +0000 Subject: [PATCH] hide version when not available --- commands.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/commands.go b/commands.go index 41e20158b8..01256b1da8 100644 --- a/commands.go +++ b/commands.go @@ -434,8 +434,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error { cmd.Usage() return nil } - - fmt.Fprintf(cli.out, "Client version: %s\n", VERSION) + if VERSION != "" { + fmt.Fprintf(cli.out, "Client version: %s\n", VERSION) + } fmt.Fprintf(cli.out, "Go version (client): %s\n", runtime.Version()) if GITCOMMIT != "" { fmt.Fprintf(cli.out, "Git commit (client): %s\n", GITCOMMIT) @@ -452,7 +453,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error { utils.Debugf("Error unmarshal: body: %s, err: %s\n", body, err) return err } - fmt.Fprintf(cli.out, "Server version: %s\n", out.Version) + if out.Version != "" { + fmt.Fprintf(cli.out, "Server version: %s\n", out.Version) + } if out.GitCommit != "" { fmt.Fprintf(cli.out, "Git commit (server): %s\n", out.GitCommit) } @@ -463,7 +466,7 @@ func (cli *DockerCli) CmdVersion(args ...string) error { release := utils.GetReleaseVersion() if release != "" { fmt.Fprintf(cli.out, "Last stable version: %s", release) - if strings.Trim(VERSION, "-dev") != release || strings.Trim(out.Version, "-dev") != release { + if (VERSION != "" || out.Version != "") && (strings.Trim(VERSION, "-dev") != release || strings.Trim(out.Version, "-dev") != release) { fmt.Fprintf(cli.out, ", please update docker") } fmt.Fprintf(cli.out, "\n")