comparison contrib/bash_completion @ 1115:89f54e72581d

bash_completion: add debugindex and debugdata support
author mpm@selenic.com
date Sat, 27 Aug 2005 20:42:53 -0700
parents bb3f23fe59f0
children f82b084bd904
comparison
equal deleted inserted replaced
1114:58371c4c2c8f 1115:89f54e72581d
1 #!/bin/bash
2
1 _hg_commands() 3 _hg_commands()
2 { 4 {
3 local commands="$(hg -v help | sed -e '1,/^list of commands:/d' \ 5 local commands="$(hg -v help | sed -e '1,/^list of commands:/d' \
4 -e '/^global options:/,$d' \ 6 -e '/^global options:/,$d' \
5 -e '/^ [^ ]/!d; s/[,:]//g;')" 7 -e '/^ [^ ]/!d; s/[,:]//g;')"
6 8
7 # hide debug commands from users, but complete them if 9 # hide debug commands from users, but complete them if
8 # specifically asked for 10 # specifically asked for
9 if [[ "$cur" == de* ]]; then 11 if [[ "$cur" == de* ]]; then
10 commands="$commands debugcheckstate debugstate debugindex" 12 commands="$commands debugcheckstate debugstate debugindex"
11 commands="$commands debugindexdot debugwalk" 13 commands="$commands debugindexdot debugwalk debugdata"
12 fi 14 fi
13 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$commands" -- "$cur") ) 15 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$commands" -- "$cur") )
14 } 16 }
15 17
16 _hg_paths() 18 _hg_paths()
133 if [ $count = 1 ]; then 135 if [ $count = 1 ]; then
134 _hg_paths 136 _hg_paths
135 fi 137 fi
136 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -d -- "$cur" )) 138 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -d -- "$cur" ))
137 ;; 139 ;;
140 debugindex|debugindexdot)
141 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.i" -- "$cur" ))
142 ;;
143 debugdata)
144 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.d" -- "$cur" ))
145 ;;
138 cat) 146 cat)
139 local count=$(_hg_count_non_option -o --output) 147 local count=$(_hg_count_non_option -o --output)
140 if [ $count = 2 ]; then 148 if [ $count = 2 ]; then
141 _hg_tags 149 _hg_tags
142 else 150 else