Mercurial > hg
comparison contrib/zsh_completion @ 18903:5df602551eea
zsh_completion: make use of `debuglabelcomplete` command
Use `debuglabelcomplete` command when populating labels list, instead of
calling `hg` three times: for branches, bookmarks and tags. Do not pass string
being completed to `hg debuglabelcomplete` (as `$words[$CURRENT]`), since it
breaks `_hg_revrange` completion (`--rev 2.5:2.5.<Tab>`) for no apparent
benefit.
Also complete `hg view` with labels, not just tags, and drop unused `_hg_tags`.
author | Nikolaj Sjujskij <sterkrig@myopera.com> |
---|---|
date | Mon, 08 Apr 2013 16:51:38 +0400 |
parents | 4f1e70ef5a79 |
children | b5ca14163742 |
comparison
equal
deleted
inserted
replaced
18902:8c0a7eeda06d | 18903:5df602551eea |
---|---|
161 compset -P 1 '*:' | 161 compset -P 1 '*:' |
162 _hg_labels "$@" | 162 _hg_labels "$@" |
163 } | 163 } |
164 | 164 |
165 _hg_labels() { | 165 _hg_labels() { |
166 _hg_tags "$@" | 166 labels=("${(f)$(_hg_cmd debuglabelcomplete)}") |
167 _hg_bookmarks "$@" | 167 (( $#labels )) && _describe -t labels 'labels' labels |
168 _hg_branches "$@" | 168 } |
169 } | 169 |
170 | |
171 _hg_tags() { | |
172 typeset -a tags | |
173 local tag rev | |
174 | |
175 _hg_cmd tags | while read tag | |
176 do | |
177 tags+=(${tag/ #[0-9]#:*}) | |
178 done | |
179 (( $#tags )) && _describe -t tags 'tags' tags | |
180 } | |
181 _hg_bookmarks() { | 170 _hg_bookmarks() { |
182 typeset -a bookmark bookmarks | 171 typeset -a bookmark bookmarks |
183 | 172 |
184 _hg_cmd bookmarks | while read -A bookmark | 173 _hg_cmd bookmarks | while read -A bookmark |
185 do | 174 do |
938 | 927 |
939 # HGK | 928 # HGK |
940 _hg_cmd_view() { | 929 _hg_cmd_view() { |
941 _arguments -s -w : $_hg_global_opts \ | 930 _arguments -s -w : $_hg_global_opts \ |
942 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ | 931 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ |
943 ':revision range:_hg_tags' | 932 ':revision range:_hg_labels' |
944 } | 933 } |
945 | 934 |
946 # MQ | 935 # MQ |
947 _hg_qseries() { | 936 _hg_qseries() { |
948 typeset -a patches | 937 typeset -a patches |