changeset 3498:776c317566b6

zsh: cache hg help output
author Brendan Cully <brendan@kublai.com>
date Tue, 24 Oct 2006 13:17:41 -0700
parents 459e7cd943d4
children e0db0b7934f2
files contrib/zsh_completion
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/zsh_completion	Tue Oct 24 13:09:09 2006 -0700
+++ b/contrib/zsh_completion	Tue Oct 24 13:17:41 2006 -0700
@@ -14,7 +14,7 @@
 
 local curcontext="$curcontext" state line
 typeset -A opt_args
-local subcmds repos newFiles addedFiles includeExclude commitMessage
+local repos newFiles addedFiles includeExclude commitMessage
 local ridx _hgroot
 
 # FIXME: why isn't opt_args available?
@@ -44,7 +44,8 @@
   esac
 }
 
-subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \
+(( $+_hg_commands )) ||
+_hg_commands=($(hg -v help | sed -e '1,/^list of commands:/d' \
       -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:].*//g;'))
 
 # A lot of commands have these arguments
@@ -88,7 +89,7 @@
     '*::command:->subcmd' && return 0
 
     if (( CURRENT == 1 )); then
-        _wanted commands expl 'hg command' compadd -a subcmds
+        _wanted commands expl 'hg command' compadd -a _hg_commands
         return
     fi
     service="$words[1]"
@@ -429,7 +430,7 @@
     ;;
 
     (help)
-        _wanted commands expl 'hg command' compadd -a subcmds
+        _wanted commands expl 'hg command' compadd -a _hg_commands
     ;;
 
     (heads)