Correctly implement and --help and or --help

This commit is contained in:
ridiculousfish 2019-09-08 10:42:24 -07:00
parent 962bfa9668
commit fa6bac1283
2 changed files with 34 additions and 1 deletions

View File

@ -66,7 +66,11 @@ RESOLVE(job_list) {
// A job decorator is AND or OR
RESOLVE(job_decorator) {
UNUSED(token2);
// If it's followed by --help, it's not a decoration.
if (token2.is_help_argument) {
*out_tag = parse_bool_none;
return production_for<empty>();
}
switch (token1.keyword) {
case parse_keyword_and: {

View File

@ -70,3 +70,32 @@ end
# CHECK: 2
# CHECK: 3
# CHECK: 4
# --help works
builtin and --help >/dev/null
echo $status
and --help >/dev/null
echo $status
# CHECK: 0
# CHECK: 0
builtin and --help >/dev/null
echo $status
and --help >/dev/null
echo $status
# CHECK: 0
# CHECK: 0
builtin or --help >/dev/null
echo $status
or --help >/dev/null
echo $status
# CHECK: 0
# CHECK: 0
builtin not --help >/dev/null
echo $status
not --help >/dev/null
echo $status
# CHECK: 0
# CHECK: 0