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>
This commit is contained in:
Ed Santiago
2019-02-26 12:28:35 -07:00
parent 4e553cfd46
commit 9934507d74
13 changed files with 22 additions and 19 deletions

View File

@@ -17,6 +17,7 @@ var (
versionCommand cliconfig.VersionValues
_versionCommand = &cobra.Command{
Use: "version",
Args: noSubArgs,
Short: "Display the Podman Version Information",
RunE: func(cmd *cobra.Command, args []string) error {
versionCommand.InputArgs = args