zsh completion: complete additional topics for `help`, not commands only
authorNikolaj Sjujskij <sterkrig@myopera.com>
Thu, 16 Aug 2012 11:21:46 +0400
changeset 17396 aaaeea31482a
parent 17395 e82fad58df1e
child 17397 c785bb3ace29
zsh completion: complete additional topics for `help`, not commands only
contrib/zsh_completion
--- a/contrib/zsh_completion	Mon Aug 27 21:10:11 2012 +0200
+++ b/contrib/zsh_completion	Thu Aug 16 11:21:46 2012 +0400
@@ -361,6 +361,19 @@
     'urls:URL:_hg_urls'
 }
 
+_hg_add_help_topics=(
+    config dates diffs environment extensions filesets glossary hgignore hgweb
+    merge-tools multirevs obsolescence patterns phases revisions revsets
+    subrepos templating urls
+)
+
+_hg_help_topics() {
+    local topics
+    (( $#_hg_cmd_list )) || _hg_get_commands
+    topics=($_hg_cmd_list $_hg_add_help_topics)
+    _describe -t help_topics 'help topics' topics
+}
+
 # Common options
 _hg_global_opts=(
     '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
@@ -588,7 +601,7 @@
 
 _hg_cmd_help() {
   _arguments -s -w : $_hg_global_opts \
-  '*:mercurial command:_hg_commands'
+  '*:mercurial help topic:_hg_help_topics'
 }
 
 _hg_cmd_identify() {