# HG changeset patch # User Brendan Cully # Date 1228418491 28800 # Node ID 21009e85ee78f0d12ccb229ec069d1fe33b45e0a # Parent 62e5d41b0a8b5f42230e1453f4b3b06b3ad88497 Update zsh completion to use debugcomplete -v instead of parsing help diff -r 62e5d41b0a8b -r 21009e85ee78 contrib/zsh_completion --- a/contrib/zsh_completion Thu Dec 04 11:21:15 2008 -0800 +++ b/contrib/zsh_completion Thu Dec 04 11:21:31 2008 -0800 @@ -116,54 +116,18 @@ _hg_get_commands() { typeset -ga _hg_cmd_list typeset -gA _hg_alias_list - local hline cmd cmdalias helpstate - local helpmode=$1 - - _call_program help hg --verbose help $helpmode 2>/dev/null | while read -A hline - do - if [ "$hline" = "list of commands:" ] - then - helpstate="commands" - continue - elif [ "$hline" = "enabled extensions:" ] - then - helpstate="extensions" - continue - elif [ "$hline" = "additional help topics:" ] - then - helpstate="topics" - continue - fi + local hline cmd cmdalias - if [ "$helpstate" = commands ] - then - cmd="$hline[1]" - case $cmd in - *:) - cmd=${cmd%:} - _hg_cmd_list+=($cmd) - ;; - *,) - cmd=${cmd%,} - _hg_cmd_list+=($cmd) - integer i=2 - while (( i <= $#hline )) - do - cmdalias=${hline[$i]%(:|,)} - _hg_cmd_list+=($cmdalias) - _hg_alias_list+=($cmdalias $cmd) - (( i++ )) - done - ;; - esac - elif [ -z "$helpmode" -a "$helpstate" = extensions ] - then - cmd="$hline[1]" - if [ -n "$cmd" ] - then - _hg_get_commands $cmd - fi - fi + _call_program hg hg debugcomplete -v 2>/dev/null | while read -A hline + do + cmd=$hline[1] + _hg_cmd_list+=($cmd) + + for cmdalias in $hline[2,-1] + do + _hg_cmd_list+=($cmdalias) + _hg_alias_list+=($cmdalias $cmd) + done done }