summaryrefslogtreecommitdiff
path: root/cmd/podman/varlink.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-02-26 12:28:35 -0700
committerEd Santiago <santiago@redhat.com>2019-02-27 14:20:29 -0700
commit9934507d74c97bccb753b04873eb74652600b6ff (patch)
treee4519b72b661fd87759f7544bef1dd4a87852c3b /cmd/podman/varlink.go
parent4e553cfd468c06ae45a88c51c57137dc4607ffe4 (diff)
downloadpodman-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/varlink.go')
-rw-r--r--cmd/podman/varlink.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go
index f19d03885..5cc79ef96 100644
--- a/cmd/podman/varlink.go
+++ b/cmd/podman/varlink.go
@@ -49,6 +49,9 @@ func varlinkCmd(c *cliconfig.VarlinkValues) error {
if len(args) < 1 {
return errors.Errorf("you must provide a varlink URI")
}
+ if len(args) > 1 {
+ return errors.Errorf("too many arguments. Requires exactly 1")
+ }
timeout := time.Duration(c.Timeout) * time.Millisecond
// Create a single runtime for varlink