remove -f on secret create and unify usage with other commands

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2017-01-06 12:06:02 -08:00
parent 567b554540
commit 62cbb25a17
1 changed files with 3 additions and 7 deletions

View File

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