The following commit has been merged in the master branch:
commit 9d810be86b29760d18883ebe2defbc63229556bf
Author: Ville Skyttä <[email protected]>
Date: Wed Apr 27 23:22:03 2011 +0300
_parse_help: Make work with pipe separated options.
diff --git a/bash_completion b/bash_completion
index 4517977..b52f5a9 100644
--- a/bash_completion
+++ b/bash_completion
@@ -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 }
diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp
index 1c314bd..8803ffe 100644
--- a/test/unit/_parse_help.exp
+++ b/test/unit/_parse_help.exp
@@ -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
--
bash-completion
_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits