diff options
author | Ed Santiago <santiago@redhat.com> | 2019-02-26 12:28:35 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2019-02-27 14:20:29 -0700 |
commit | 9934507d74c97bccb753b04873eb74652600b6ff (patch) | |
tree | e4519b72b661fd87759f7544bef1dd4a87852c3b /cmd/podman/ps.go | |
parent | 4e553cfd468c06ae45a88c51c57137dc4607ffe4 (diff) | |
download | podman-9934507d74c97bccb753b04873eb74652600b6ff.tar.gz podman-9934507d74c97bccb753b04873eb74652600b6ff.tar.bz2 podman-9934507d74c97bccb753b04873eb74652600b6ff.zip |
Command-line input validation: reject unused args
Several podman commands accept no subcommands. Some
of those were not actually checking, though, which
could lead to user confusion. Added validation where
missing; and, refactored to minimize duplication.
(Side note: I decided against using cobra.NoArgs
because its error message, "unknown command",
misleadingly implies that there are known ones).
Also added validation to varlink
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'cmd/podman/ps.go')
-rw-r--r-- | cmd/podman/ps.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 3bc4f0b08..d6edcabcb 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -159,6 +159,7 @@ var ( psDescription = "Prints out information about the containers" _psCommand = &cobra.Command{ Use: "ps", + Args: noSubArgs, Short: "List containers", Long: psDescription, RunE: func(cmd *cobra.Command, args []string) error { @@ -215,10 +216,6 @@ func psCmd(c *cliconfig.PsValues) error { defer runtime.Shutdown(false) - if len(c.InputArgs) > 0 { - return errors.Errorf("too many arguments, ps takes no arguments") - } - opts := shared.PsOptions{ All: c.All, Format: c.Format, |