summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-01-25 11:22:18 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-02-01 11:36:02 +0000
commit061dc888d3bef5ab85ab1afccd54e2d3323d1177 (patch)
treeaf4be48385a57e3983ab917819221c07feb0697f
parentce211bb8d11a030dbb9ad99f9590a378efdd4580 (diff)
downloadzsh-061dc888d3bef5ab85ab1afccd54e2d3323d1177.tar.gz
zsh-061dc888d3bef5ab85ab1afccd54e2d3323d1177.zip
34411: _hg completion: Complete bookmark names for -r
While there, simplify `hg tags` parsing.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_hg25
2 files changed, 22 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 66f3866cd..8b80a7e6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-01 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 34411: Completion/Unix/Command/_hg: _hg completion: Complete
+ bookmark names for -r
+
2015-01-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 34439: Src/Modules/db_gdbm.c: unset parameter that's about to
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index c18500bcb..e7c21b9d1 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -162,15 +162,24 @@ _hg_revrange() {
_hg_tags "$@"
}
-_hg_tags() {
- typeset -a tags
- local tag rev
+_hg_tags_internal() {
+ local expl
+ typeset -a hgtags
+ hgtags=( ${(f)"$(_hg_cmd tags -q 2>/dev/null)"} )
+ _wanted tags expl 'tags' compadd -a - hgtags
+}
- _hg_cmd tags 2> /dev/null | while read tag
- do
- tags+=(${tag/ # [0-9]#:*})
- done
- (( $#tags )) && _describe -t tags 'tags' tags
+_hg_bookmarks_internal() {
+ local expl
+ typeset -a hgbookmarks
+ hgbookmarks=( ${(f)"$(_hg_cmd bookmarks -q 2>/dev/null)"} )
+ _wanted bookmarks expl 'bookmarks' compadd -a - hgbookmarks
+}
+
+_hg_tags() {
+ _alternative \
+ 'bookmarks:bookmark:_hg_bookmarks_internal' \
+ 'tags:tag:_hg_tags_internal'
}
# likely merge candidates