Show More
@@ -116,54 +116,18 b' typeset -A _hg_cmd_globals' | |||||
116 | _hg_get_commands() { |
|
116 | _hg_get_commands() { | |
117 | typeset -ga _hg_cmd_list |
|
117 | typeset -ga _hg_cmd_list | |
118 | typeset -gA _hg_alias_list |
|
118 | typeset -gA _hg_alias_list | |
119 |
local hline cmd cmdalias |
|
119 | local hline cmd cmdalias | |
120 | local helpmode=$1 |
|
|||
121 |
|
120 | |||
122 |
_call_program h |
|
121 | _call_program hg hg debugcomplete -v 2>/dev/null | while read -A hline | |
123 | do |
|
122 | do | |
124 | if [ "$hline" = "list of commands:" ] |
|
123 | cmd=$hline[1] | |
125 | then |
|
124 | _hg_cmd_list+=($cmd) | |
126 | helpstate="commands" |
|
|||
127 | continue |
|
|||
128 | elif [ "$hline" = "enabled extensions:" ] |
|
|||
129 | then |
|
|||
130 | helpstate="extensions" |
|
|||
131 | continue |
|
|||
132 | elif [ "$hline" = "additional help topics:" ] |
|
|||
133 | then |
|
|||
134 | helpstate="topics" |
|
|||
135 | continue |
|
|||
136 | fi |
|
|||
137 |
|
125 | |||
138 | if [ "$helpstate" = commands ] |
|
126 | for cmdalias in $hline[2,-1] | |
139 | then |
|
|||
140 | cmd="$hline[1]" |
|
|||
141 | case $cmd in |
|
|||
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 |
|
|
127 | do | |
152 | cmdalias=${hline[$i]%(:|,)} |
|
|||
153 |
|
|
128 | _hg_cmd_list+=($cmdalias) | |
154 |
|
|
129 | _hg_alias_list+=($cmdalias $cmd) | |
155 | (( i++ )) |
|
|||
156 |
|
|
130 | 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 |
|
|||
167 | done |
|
131 | done | |
168 | } |
|
132 | } | |
169 |
|
133 |
General Comments 0
You need to be logged in to leave comments.
Login now