Show More
@@ -4,14 +4,13 b'' | |||||
4 | # it into your zsh function path (/usr/share/zsh/site-functions for |
|
4 | # it into your zsh function path (/usr/share/zsh/site-functions for | |
5 | # instance) |
|
5 | # instance) | |
6 | # |
|
6 | # | |
7 | # Copyright (C) 2005 Steve Borho |
|
7 | # Copyright (C) 2005-6 Steve Borho | |
8 | # Copyright (C) 2006-8 Brendan Cully <brendan@kublai.com> |
|
8 | # Copyright (C) 2006-8 Brendan Cully <brendan@kublai.com> | |
9 | # |
|
9 | # | |
10 | # This is free software; you can redistribute it and/or modify it under |
|
10 | # This is free software; you can redistribute it and/or modify it under | |
11 | # the terms of the GNU General Public License as published by the Free |
|
11 | # the terms of the GNU General Public License as published by the Free | |
12 | # Software Foundation; either version 2 of the License, or (at your |
|
12 | # Software Foundation; either version 2 of the License, or (at your | |
13 | # option) any later version. |
|
13 | # option) any later version. | |
14 | # |
|
|||
15 |
|
14 | |||
16 | emulate -LR zsh |
|
15 | emulate -LR zsh | |
17 | setopt extendedglob |
|
16 | setopt extendedglob | |
@@ -117,28 +116,54 b' typeset -A _hg_cmd_globals' | |||||
117 | _hg_get_commands() { |
|
116 | _hg_get_commands() { | |
118 | typeset -ga _hg_cmd_list |
|
117 | typeset -ga _hg_cmd_list | |
119 | typeset -gA _hg_alias_list |
|
118 | typeset -gA _hg_alias_list | |
120 | local hline cmd cmdalias |
|
119 | local hline cmd cmdalias helpstate | |
121 | _call_program help hg --verbose help | while read -A hline |
|
120 | local helpmode=$1 | |
|
121 | ||||
|
122 | _call_program help hg --verbose help $helpmode 2>/dev/null | while read -A hline | |||
122 | do |
|
123 | do | |
123 | cmd="$hline[1]" |
|
124 | if [ "$hline" = "list of commands:" ] | |
124 | case $cmd in |
|
125 | then | |
125 | *:) |
|
126 | helpstate="commands" | |
126 | cmd=${cmd%:} |
|
127 | continue | |
127 | _hg_cmd_list+=($cmd) |
|
128 | elif [ "$hline" = "enabled extensions:" ] | |
128 | ;; |
|
129 | then | |
129 | *,) |
|
130 | helpstate="extensions" | |
130 | cmd=${cmd%,} |
|
131 | continue | |
131 | _hg_cmd_list+=($cmd) |
|
132 | elif [ "$hline" = "additional help topics:" ] | |
132 | integer i=2 |
|
133 | then | |
133 | while (( i <= $#hline )) |
|
134 | helpstate="topics" | |
134 | do |
|
135 | continue | |
135 | cmdalias=${hline[$i]%(:|,)} |
|
136 | fi | |
136 | _hg_cmd_list+=($cmdalias) |
|
137 | ||
137 | _hg_alias_list+=($cmdalias $cmd) |
|
138 | if [ "$helpstate" = commands ] | |
138 | (( i++ )) |
|
139 | then | |
139 | done |
|
140 | cmd="$hline[1]" | |
140 | ;; |
|
141 | case $cmd in | |
141 | esac |
|
142 | *:) | |
|
143 | cmd=${cmd%:} | |||
|
144 | _hg_cmd_list+=($cmd) | |||
|
145 | ;; | |||
|
146 | *,) | |||
|
147 | cmd=${cmd%,} | |||
|
148 | _hg_cmd_list+=($cmd) | |||
|
149 | integer i=2 | |||
|
150 | while (( i <= $#hline )) | |||
|
151 | do | |||
|
152 | cmdalias=${hline[$i]%(:|,)} | |||
|
153 | _hg_cmd_list+=($cmdalias) | |||
|
154 | _hg_alias_list+=($cmdalias $cmd) | |||
|
155 | (( i++ )) | |||
|
156 | done | |||
|
157 | ;; | |||
|
158 | esac | |||
|
159 | elif [ -z "$helpmode" -a "$helpstate" = extensions ] | |||
|
160 | then | |||
|
161 | cmd="$hline[1]" | |||
|
162 | if [ -n "$cmd" ] | |||
|
163 | then | |||
|
164 | _hg_get_commands $cmd | |||
|
165 | fi | |||
|
166 | fi | |||
142 | done |
|
167 | done | |
143 | } |
|
168 | } | |
144 |
|
169 |
General Comments 0
You need to be logged in to leave comments.
Login now