bash_completion: small cleanup and bugfix
_hg_count_non_option wasn't taking global options into account
while counting non-option arguments.
It also used only its first argument.
--- a/contrib/bash_completion Mon Aug 29 20:37:07 2005 +0200
+++ b/contrib/bash_completion Mon Aug 29 20:37:07 2005 +0200
@@ -41,11 +41,9 @@
for (( i=1; $i<=$COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
- for f in $filters; do
- if [[ ${COMP_WORDS[i-1]} == $f ]]; then
- continue 2
- fi
- done
+ if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
+ continue
+ fi
count=$(($count + 1))
fi
done
@@ -154,7 +152,7 @@
COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.d" -- "$cur" ))
;;
cat)
- local count=$(_hg_count_non_option -o --output)
+ local count=$(_hg_count_non_option '-o|--output')
if [ $count = 2 ]; then
_hg_tags
else