Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/bash_completion @ 1150:4ee09418c8e5
bash_completion: better handling of aliases
Instead of listing every alias in the big case..esac, use hg help
to get the canonical name of the command.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 29 Aug 2005 20:37:07 +0200 |
parents | f82b084bd904 |
children | 10b4f2a5ce17 |
comparison
equal
deleted
inserted
replaced
1149:f82b084bd904 | 1150:4ee09418c8e5 |
---|---|
88 if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then | 88 if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then |
89 _hg_commands | 89 _hg_commands |
90 return | 90 return |
91 fi | 91 fi |
92 | 92 |
93 # canonicalize command name | |
94 cmd=$(hg -q help "$cmd" | sed -e 's/^hg //; s/ .*//; 1q') | |
95 | |
93 if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then | 96 if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then |
94 _hg_tags | 97 _hg_tags |
95 return | 98 return |
96 fi | 99 fi |
97 | 100 |
98 case "$cmd" in | 101 case "$cmd" in |
99 help) | 102 help) |
100 _hg_commands | 103 _hg_commands |
101 ;; | 104 ;; |
102 export|manifest|update|checkout|up|co) | 105 export|manifest|update) |
103 _hg_tags | 106 _hg_tags |
104 ;; | 107 ;; |
105 pull|push|outgoing|incoming|out|in) | 108 pull|push|outgoing|incoming) |
106 _hg_paths | 109 _hg_paths |
107 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -d -- "$cur" )) | 110 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -d -- "$cur" )) |
108 ;; | 111 ;; |
109 paths) | 112 paths) |
110 _hg_paths | 113 _hg_paths |
111 ;; | 114 ;; |
112 add) | 115 add) |
113 _hg_status "u" | 116 _hg_status "u" |
114 ;; | 117 ;; |
115 commit|ci) | 118 commit) |
116 _hg_status "mra" | 119 _hg_status "mra" |
117 ;; | 120 ;; |
118 remove) | 121 remove) |
119 _hg_status "r" | 122 _hg_status "r" |
120 ;; | 123 ;; |