Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _mercurial



Here's wondering if someone will reply with a more comprehensive
completion function.

Index: Completion/Unix/Command/_mercurial
===================================================================
RCS file: Completion/Unix/Command/_mercurial
diff -N Completion/Unix/Command/_mercurial
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_mercurial	8 Mar 2007 04:26:19 -0000
@@ -0,0 +1,27 @@
+#compdef hg
+
+local context state line
+typeset -A opt_args
+
+if (( ! $+_mercurial_cmds )); then
+  local _mercurial_cmds
+  _mercurial_cmds=( $($service debugcomplete) )
+fi
+if (( ! $+_mercurial_options )); then
+  local _mercurial_options
+  _mercurial_options=( $($service debugcomplete --options) )
+fi
+
+_arguments \
+  "$_mercurial_options[@]" \
+  '*:command:->subcmds' && return 0
+
+case "$state" in
+  (subcmds)
+    if (( CURRENT == 2 )); then
+      compadd -- "$_mercurial_cmds[@]"
+    else
+      _files
+    fi
+  ;;
+esac



Messages sorted by: Reverse Date, Date, Thread, Author