diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-01 12:22:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 12:22:12 -0800 |
commit | e4746f9b4b679548d88f0ea94f73d760b2658c3c (patch) | |
tree | 7911dcb15acde80a1c03529e7d42a6dcc9cd45f2 /cmd/podman/common.go | |
parent | ce8d7b8539ec724cce7eac14d5d555c3c3c23266 (diff) | |
parent | 9934507d74c97bccb753b04873eb74652600b6ff (diff) | |
download | podman-e4746f9b4b679548d88f0ea94f73d760b2658c3c.tar.gz podman-e4746f9b4b679548d88f0ea94f73d760b2658c3c.tar.bz2 podman-e4746f9b4b679548d88f0ea94f73d760b2658c3c.zip |
Merge pull request #2452 from edsantiago/no_more_args
Command-line input validation: reject unused args
Diffstat (limited to 'cmd/podman/common.go')
-rw-r--r-- | cmd/podman/common.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/podman/common.go b/cmd/podman/common.go index e980e10f9..d3387b8f4 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -59,6 +59,14 @@ func checkAllAndLatest(c *cobra.Command, args []string, ignoreArgLen bool) error return nil } +// noSubArgs checks that there are no further positional parameters +func noSubArgs(c *cobra.Command, args []string) error { + if len(args) > 0 { + return errors.Errorf("`%s` takes no arguments", c.CommandPath()) + } + return nil +} + // getAllOrLatestContainers tries to return the correct list of containers // depending if --all, --latest or <container-id> is used. // It requires the Context (c) and the Runtime (runtime). As different |