From d97f9d68fdbb478f1498a91c4fb5934dc85ef15a Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 26 Jun 2020 12:35:51 +0200 Subject: [PATCH] Add missing f shorthand for version command --- cli/cmd/version.go | 2 +- tests/e2e/e2e_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/cmd/version.go b/cli/cmd/version.go index 285f169d..3bea2b12 100644 --- a/cli/cmd/version.go +++ b/cli/cmd/version.go @@ -38,7 +38,7 @@ func VersionCommand(version string) *cobra.Command { } // define flags for backward compatibility with com.docker.cli flags := cmd.Flags() - flags.String("format", "", "Format the output using the given Go template") + flags.StringP("format", "f", "", "Format the output using the given Go template") flags.String("kubeconfig", "", "Kubernetes config file") mobyflags.AddMobyFlagsForRetrocompatibility(flags) diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 6e2aa945..31b9034f 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -239,6 +239,11 @@ func (s *E2eSuite) TestDisplaysAdditionalLineInDockerVersion() { Expect(output).To(ContainSubstring("Azure integration")) } +func (s *E2eSuite) TestAllowsFormatFlagInVersion() { + s.NewDockerCommand("version", "-f", "{{ json . }}").ExecOrDie() + s.NewDockerCommand("version", "--format", "{{ json . }}").ExecOrDie() +} + func (s *E2eSuite) TestMockBackend() { It("creates a new test context to hardcoded example backend", func() { s.NewDockerCommand("context", "create", "example", "test-example").ExecOrDie()