zsh_completion: add -l/--list flag for hg bookmarks completion
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 17 Oct 2018 22:32:50 +0800
changeset 40336 d365e2b7aa2a
parent 40335 01bdf7294274
child 40337 cb516a854bc7
zsh_completion: add -l/--list flag for hg bookmarks completion Flags in parentheses are mutually exclusive. Logic is taken from commands.py: selactions = [k for k in ['delete', 'rename', 'list'] if opts.get(k)] if len(selactions) > 1: raise error.Abort(_('--%s and --%s are incompatible') % tuple(selactions[:2])) ... if rev and action in {'delete', 'rename', 'list'}: raise error.Abort(_("--rev is incompatible with --%s") % action) if inactive and action in {'delete', 'list'}: raise error.Abort(_("--inactive is incompatible with --%s") % action) Differential Revision: https://phab.mercurial-scm.org/D5142
contrib/zsh_completion
--- a/contrib/zsh_completion	Wed Oct 17 22:31:34 2018 +0800
+++ b/contrib/zsh_completion	Wed Oct 17 22:32:50 2018 +0800
@@ -532,10 +532,11 @@
 _hg_cmd_bookmarks() {
   _arguments -s -S : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[force]' \
-  '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \
-  '(--rev -r --delete -d --rename -m)'{-r+,--rev=}'[revision]:revision:_hg_labels' \
-  '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
-  '(--rev -r --delete -d --rename -m)'{-m+,--rename=}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
+  '(--inactive -i --delete -d --list -l)'{-i,--inactive}'[mark a bookmark inactive]' \
+  '(--rev -r --delete -d --rename -m --list -l)'{-r+,--rev=}'[revision]:revision:_hg_labels' \
+  '(--rev -r --delete -d --rename -m --list -l --inactive -i)'{-d,--delete}'[delete a given bookmark]' \
+  '(--rev -r --delete -d --rename -m --list -l)'{-m+,--rename=}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
+  '(--inactive -i --delete -d --list -l)'{-l,--list}'[list existing bookmarks]' \
   ':bookmark:_hg_bookmarks'
 }