diff contrib/bash_completion @ 1152:ff560ce0c635

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.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 29 Aug 2005 20:37:07 +0200
parents 10b4f2a5ce17
children fa9ae7df88a9
line wrap: on
line diff
--- 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