From 34b2bd68dc6dc9c034e0a412083e349dd295bd15 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 1 Nov 2019 16:01:02 -0700 Subject: [PATCH] fix(version): implement `helm version -c`, mark as hidden Signed-off-by: Matthew Fisher --- cmd/helm/testdata/output/version-client-shorthand.txt | 1 + cmd/helm/testdata/output/version-client.txt | 1 + cmd/helm/version.go | 2 ++ cmd/helm/version_test.go | 8 ++++++++ 4 files changed, 12 insertions(+) create mode 100644 cmd/helm/testdata/output/version-client-shorthand.txt create mode 100644 cmd/helm/testdata/output/version-client.txt diff --git a/cmd/helm/testdata/output/version-client-shorthand.txt b/cmd/helm/testdata/output/version-client-shorthand.txt new file mode 100644 index 000000000..4b493d31c --- /dev/null +++ b/cmd/helm/testdata/output/version-client-shorthand.txt @@ -0,0 +1 @@ +version.BuildInfo{Version:"v3.0", GitCommit:"", GitTreeState:"", GoVersion:""} diff --git a/cmd/helm/testdata/output/version-client.txt b/cmd/helm/testdata/output/version-client.txt new file mode 100644 index 000000000..4b493d31c --- /dev/null +++ b/cmd/helm/testdata/output/version-client.txt @@ -0,0 +1 @@ +version.BuildInfo{Version:"v3.0", GitCommit:"", GitTreeState:"", GoVersion:""} diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 8c0c11484..3067f7289 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -61,6 +61,8 @@ func newVersionCmd(out io.Writer) *cobra.Command { f := cmd.Flags() f.BoolVar(&o.short, "short", false, "print the version number") f.StringVar(&o.template, "template", "", "template for version string format") + f.BoolP("client", "c", true, "display client version information") + f.MarkHidden("client") return cmd } diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index 89b89093e..134401948 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -32,6 +32,14 @@ func TestVersion(t *testing.T) { name: "template", cmd: "version --template='Version: {{.Version}}'", golden: "output/version-template.txt", + }, { + name: "client", + cmd: "version --client", + golden: "output/version-client.txt", + }, { + name: "client shorthand", + cmd: "version -c", + golden: "output/version-client-shorthand.txt", }} runTestCmd(t, tests) }