changeset 39404:b4e7e1f09c09

zsh_completion: complete merge tools for -t/--tool Differential Revision: https://phab.mercurial-scm.org/D4362
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 22 Aug 2018 08:20:51 +0800
parents 5f8282f368b2
children 0f549da54379
files contrib/zsh_completion
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/zsh_completion	Wed Jun 06 01:46:37 2018 +0200
+++ b/contrib/zsh_completion	Wed Aug 22 08:20:51 2018 +0800
@@ -281,6 +281,18 @@
     (( $#items )) && _describe -t config 'config item' items
 }
 
+_hg_internal_merge_tools=(
+  \\:dump \\:fail \\:forcedump \\:local \\:merge \\:merge-local \\:merge-other
+  \\:merge3 \\:other \\:prompt \\:tagmerge \\:union
+)
+
+_hg_merge_tools() {
+  typeset -a external_tools
+  _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools
+  external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"})
+  (( $#external_tools )) && _describe -t external_tools 'external merge tools' external_tools
+}
+
 _hg_addremove() {
   _alternative 'files:unknown files:_hg_unknown' \
     'files:missing files:_hg_missing'
@@ -416,7 +428,7 @@
   '--nodates[omit dates from diff headers]')
 
 _hg_mergetool_opts=(
-  '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool'
+  '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool:_hg_merge_tools'
 )
 
 _hg_dryrun_opts=(