Merge pull request #293 from docker/version_f_shorthand

Add missing f shorthand for version command
This commit is contained in:
Djordje Lukic 2020-06-26 15:38:50 +02:00 committed by GitHub
commit e3b6a470fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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()