mirror of https://github.com/docker/cli.git
remove -f on secret create and unify usage with other commands
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
567b554540
commit
62cbb25a17
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue