contrib/bash_completion
changeset 1152 ff560ce0c635
parent 1151 10b4f2a5ce17
child 1153 fa9ae7df88a9
equal deleted inserted replaced
1151:10b4f2a5ce17 1152:ff560ce0c635
    39     local i count=0
    39     local i count=0
    40     local filters="$1"
    40     local filters="$1"
    41 
    41 
    42     for (( i=1; $i<=$COMP_CWORD; i++ )); do
    42     for (( i=1; $i<=$COMP_CWORD; i++ )); do
    43 	if [[ "${COMP_WORDS[i]}" != -* ]]; then
    43 	if [[ "${COMP_WORDS[i]}" != -* ]]; then
    44 	    for f in $filters; do
    44 	    if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
    45 		if [[ ${COMP_WORDS[i-1]} == $f ]]; then
    45 		continue
    46 		    continue 2
    46 	    fi
    47 		fi
       
    48 	    done
       
    49 	    count=$(($count + 1))
    47 	    count=$(($count + 1))
    50 	fi
    48 	fi
    51     done
    49     done
    52 
    50 
    53     echo $(($count - 1))
    51     echo $(($count - 1))
   152 	;;
   150 	;;
   153 	debugdata)
   151 	debugdata)
   154 	    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.d" -- "$cur" ))
   152 	    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.d" -- "$cur" ))
   155 	;;
   153 	;;
   156 	cat)
   154 	cat)
   157 	    local count=$(_hg_count_non_option -o --output)
   155 	    local count=$(_hg_count_non_option '-o|--output')
   158 	    if [ $count = 2 ]; then
   156 	    if [ $count = 2 ]; then
   159 		_hg_tags
   157 		_hg_tags
   160 	    else
   158 	    else
   161 		COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -- "$cur" ))
   159 		COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -- "$cur" ))
   162 	    fi
   160 	    fi