_parse_help: Expand --[no]foo to --foo and --nofoo.
This commit is contained in:
parent
1709686b7e
commit
b6cdacf1f9
@ -759,8 +759,18 @@ _parse_help()
|
||||
if ($i !~ /^-/) { break }
|
||||
}
|
||||
if (x == -1) { x = 1 }
|
||||
sub("[=<{[].*", "", $x);
|
||||
print $x
|
||||
if ($x ~ /^--?[[]no[]]./) {
|
||||
y = $x ; sub("[[]no[]]", "", y)
|
||||
z = $x ; sub("[[]no[]]", "no", z)
|
||||
sub("[=<{[].*", "", y)
|
||||
sub("[=<{[].*", "", z)
|
||||
print y
|
||||
print z
|
||||
}
|
||||
else {
|
||||
sub("[=<{[].*", "", $x)
|
||||
print $x
|
||||
}
|
||||
}'
|
||||
}
|
||||
|
||||
|
@ -89,5 +89,9 @@ set cmd {fn() { printf '%s\n' "--foo={bar,quux}"; }; _parse_help fn}
|
||||
assert_bash_list "--foo" $cmd "long with value in curly brackets"
|
||||
sync_after_int
|
||||
|
||||
set cmd {fn() { printf '%s\n' "--[no]foo"; }; _parse_help fn}
|
||||
assert_bash_list "--foo\n--nofoo" $cmd "long with \[no\]"
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
Loading…
x
Reference in New Issue
Block a user