_parse_help: Make work with pipe separated options.
This commit is contained in:
parent
fabbec105c
commit
9d810be86b
@ -752,7 +752,7 @@ _parse_help()
|
||||
"$cmd" ${2:---help} 2>&1 | awk \
|
||||
'{
|
||||
if ($0 !~ /^[ \t]*-/) { next }
|
||||
gsub("[,/]", " ");
|
||||
gsub("[,/|]", " ");
|
||||
x = -1;
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /^--[^-]/) { x = i ; break }
|
||||
|
@ -69,6 +69,10 @@ set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn}
|
||||
assert_bash_list "--upload-file" $cmd "short + long, slash separated"
|
||||
sync_after_int
|
||||
|
||||
set cmd {fn() { printf '%s\n' "-T|--upload-file"; }; _parse_help fn}
|
||||
assert_bash_list "--upload-file" $cmd "pipe separated"
|
||||
sync_after_int
|
||||
|
||||
set cmd {fn() { printf '%s\n' "-f, -F, --foo"; }; _parse_help fn}
|
||||
assert_bash_list "--foo" $cmd "short + short + long"
|
||||
sync_after_int
|
||||
|
Loading…
x
Reference in New Issue
Block a user