]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh -eu | |
2 | ||
3 | export SYSTEMD_LOG_LEVEL=info | |
4 | ||
5 | # output width | |
6 | if "$1" --help | grep -v 'default:' | grep -E -q '.{80}.'; then | |
7 | echo "$(basename "$1") --help output is too wide:" | |
8 | "$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}' | |
9 | exit 1 | |
10 | fi | |
11 | ||
12 | # no --help output to stdout | |
13 | if "$1" --help 2>&1 1>/dev/null | grep .; then | |
14 | echo "$(basename "$1") --help prints to stderr" | |
15 | exit 2 | |
16 | fi | |
17 | ||
18 | # error output to stderr | |
19 | if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then | |
20 | echo "$(basename "$1") with an unknown parameter does not print to stderr" | |
21 | exit 3 | |
22 | fi |