The following commit has been merged in the master branch:
commit 8f68300a0d97e9e9b3d2cd8740519d2e29233754
Author: Ville Skyttä <[email protected]>
Date: Fri Dec 11 00:14:54 2009 +0200
Add wordbreak filtering to _count_args.
diff --git a/bash_completion b/bash_completion
index 7e3403c..55c8919 100644
--- a/bash_completion
+++ b/bash_completion
@@ -728,15 +728,16 @@ _realcommand() {
# This function counts the number of args
-#
+# @param $1 chars Characters out of $COMP_WORDBREAKS which should
+# NOT be considered word breaks. See __reassemble_comp_words_by_ref.
_count_args()
{
- local i
+ local i cword words
+ __reassemble_comp_words_by_ref "$1" words cword
+
args=1
- for (( i=1; i < COMP_CWORD; i++ )); do
- if [[ "${COMP_WORDS[i]}" != -* ]]; then
- args=$(($args+1))
- fi
+ for i in "${wor...@]:1:cword-1}"; do
+ [[ "$i" != -* ]] && args=$(($args+1))
done
}
--
bash-completion
_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits