From 061dc888d3bef5ab85ab1afccd54e2d3323d1177 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Jan 2015 11:22:18 +0000 Subject: 34411: _hg completion: Complete bookmark names for -r While there, simplify `hg tags` parsing. --- Completion/Unix/Command/_hg | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'Completion') 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 -- cgit 1.4.1