diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-24 09:27:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-24 09:27:07 -0400 |
commit | c48a5420135ecbff294e1fbce95be0adf9fc2931 (patch) | |
tree | ab0c8e41595adfbec664ffc7e9c7cbfdf6e51623 /cmd/podman/validate | |
parent | b74238864fe4a6fe22f3a8a370e9a32ea21ee383 (diff) | |
parent | 6864a5547a774d19a7ccb9d50a7799b721fb66ef (diff) | |
download | podman-c48a5420135ecbff294e1fbce95be0adf9fc2931.tar.gz podman-c48a5420135ecbff294e1fbce95be0adf9fc2931.tar.bz2 podman-c48a5420135ecbff294e1fbce95be0adf9fc2931.zip |
Merge pull request #6733 from edsantiago/bats_help_extra_args
BATS tests: new too-many-arguments test
Diffstat (limited to 'cmd/podman/validate')
-rw-r--r-- | cmd/podman/validate/args.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/podman/validate/args.go b/cmd/podman/validate/args.go index 69240798f..d170447ee 100644 --- a/cmd/podman/validate/args.go +++ b/cmd/podman/validate/args.go @@ -25,8 +25,11 @@ func SubCommandExists(cmd *cobra.Command, args []string) error { // IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag func IDOrLatestArgs(cmd *cobra.Command, args []string) error { - if len(args) > 1 || (len(args) == 0 && !cmd.Flag("latest").Changed) { - return fmt.Errorf("`%s` requires a name, id or the \"--latest\" flag", cmd.CommandPath()) + if len(args) > 1 { + return fmt.Errorf("`%s` accepts at most one argument", cmd.CommandPath()) + } + if len(args) == 0 && !cmd.Flag("latest").Changed { + return fmt.Errorf("`%s` requires a name, id, or the \"--latest\" flag", cmd.CommandPath()) } return nil } |