Files
podman/test/system/300-cli-parsing.bats
Paul Holzinger 44d037898e 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>
2022-02-21 19:12:12 +01:00

30 lines
806 B
Bash

#!/usr/bin/env bats -*- bats -*-
#
# Various command-line parsing regression tests that don't fit in elsewhere
#
load helpers
@test "podman cli parsing - quoted args - #2574" {
# 1.1.2 fails with:
# Error: invalid argument "true=\"false\"" for "-l, --label" \
# flag: parse error on line 1, column 5: bare " in non-quoted-field
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