summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-02-21 16:28:04 +0100
committerPaul Holzinger <pholzing@redhat.com>2022-02-21 19:12:12 +0100
commit44d037898ebc328432823d51ca2da298902a46e9 (patch)
tree68ed394ca8fb0d6fc58499ab35053811ebc4feb9 /test/system
parentd224a0f8ac4978c3ac399a0940f785892d63daa8 (diff)
downloadpodman-44d037898ebc328432823d51ca2da298902a46e9.tar.gz
podman-44d037898ebc328432823d51ca2da298902a46e9.tar.bz2
podman-44d037898ebc328432823d51ca2da298902a46e9.zip
provide better error on invalid flag
Add a extra `See 'podman command --help'` to the error output. With this patch you now get: ``` $ podman run -h Error: flag needs an argument: 'h' in -h See 'podman run --help' ``` Fixes #13082 Fixes #13002 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/001-basic.bats3
-rw-r--r--test/system/300-cli-parsing.bats14
2 files changed, 16 insertions, 1 deletions
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 9b0a71285..761bb0f76 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -88,7 +88,8 @@ function setup() {
# ...but no matter what, --remote is never allowed after subcommand
PODMAN="${podman_non_remote} ${podman_args[@]}" run_podman 125 version --remote
- is "$output" "Error: unknown flag: --remote" "podman version --remote"
+ is "$output" "Error: unknown flag: --remote
+See 'podman version --help'" "podman version --remote"
}
@test "podman-remote: defaults" {
diff --git a/test/system/300-cli-parsing.bats b/test/system/300-cli-parsing.bats
index 92c073102..ec493d3d8 100644
--- a/test/system/300-cli-parsing.bats
+++ b/test/system/300-cli-parsing.bats
@@ -12,4 +12,18 @@ load helpers
run_podman run --rm --label 'true="false"' $IMAGE true
}
+@test "podman flag error" {
+ local name="podman"
+ if is_remote; then
+ name="podman-remote"
+ fi
+ run_podman 125 run -h
+ is "$output" "Error: flag needs an argument: 'h' in -h
+See '$name run --help'" "expected error output"
+
+ run_podman 125 bad --invalid
+ is "$output" "Error: unknown flag: --invalid
+See '$name --help'" "expected error output"
+}
+
# vim: filetype=sh