Show More
@@ -3,23 +3,23 b' shopt -s extglob' | |||||
3 | _hg_command_list() |
|
3 | _hg_command_list() | |
4 | { |
|
4 | { | |
5 | "$hg" --debug help 2>/dev/null | \ |
|
5 | "$hg" --debug help 2>/dev/null | \ | |
6 | awk 'function command_line(line) { |
|
6 | awk -F', ' '/^list of commands:/ {commands=1} | |
7 | gsub(/,/, "", line) |
|
7 | commands && /^ [^ ]/ { | |
8 |
|
|
8 | sub(/ /, "") | |
9 | split(line, aliases) |
|
9 | sub(/:.*/, "") | |
10 |
command = |
|
10 | command = $1 | |
11 | delete aliases[1] |
|
11 | if (index(command, "debug") == 1) { | |
|
12 | for (i=1; i<=NF; i++) | |||
|
13 | debug[j++] = $i | |||
|
14 | next | |||
|
15 | } | |||
12 | print command |
|
16 | print command | |
13 |
for (i |
|
17 | for (i=2; i<=NF; i++) | |
14 |
if (index(command, |
|
18 | if (index(command, $i) != 1) | |
15 |
print |
|
19 | print $i | |
16 | } |
|
20 | } | |
17 | /^list of commands:/ {commands=1} |
|
|||
18 | commands && /^ debug/ {a[i++] = $0; next;} |
|
|||
19 | commands && /^ [^ ]/ {command_line($0)} |
|
|||
20 | /^global options:/ {exit 0} |
|
21 | /^global options:/ {exit 0} | |
21 |
END {for (i in |
|
22 | END {for (i in debug) print debug[i]}' | |
22 |
|
||||
23 | } |
|
23 | } | |
24 |
|
24 | |||
25 | _hg_option_list() |
|
25 | _hg_option_list() |
General Comments 0
You need to be logged in to leave comments.
Login now