From 62cbb25a176cc4f743127203f4663a99d78eace7 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 6 Jan 2017 12:06:02 -0800 Subject: [PATCH] remove -f on secret create and unify usage with other commands Signed-off-by: Victor Vieux --- command/secret/create.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/command/secret/create.go b/command/secret/create.go index 6967fb51ee..a3248e5dfe 100644 --- a/command/secret/create.go +++ b/command/secret/create.go @@ -27,17 +27,17 @@ func newSecretCreateCommand(dockerCli *command.DockerCli) *cobra.Command { } cmd := &cobra.Command{ - Use: "create [OPTIONS] SECRET", + Use: "create [OPTIONS] SECRET file|-", Short: "Create a secret from a file or STDIN as content", - Args: cli.ExactArgs(1), + Args: cli.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { createOpts.name = args[0] + createOpts.file = args[1] return runSecretCreate(dockerCli, createOpts) }, } flags := cmd.Flags() flags.VarP(&createOpts.labels, "label", "l", "Secret labels") - flags.StringVarP(&createOpts.file, "file", "f", "", "Read from a file or STDIN ('-')") return cmd } @@ -46,10 +46,6 @@ func runSecretCreate(dockerCli *command.DockerCli, options createOptions) error client := dockerCli.Client() ctx := context.Background() - if options.file == "" { - return fmt.Errorf("Please specify either a file name or STDIN ('-') with --file") - } - var in io.Reader = dockerCli.In() if options.file != "-" { file, err := system.OpenSequential(options.file)