equal
deleted
inserted
replaced
2 |
2 |
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 -F', ' '/^list of commands:/ {commands=1} |
6 awk -F', ' '/^list of commands:/ {commands=1} |
7 commands && /^ [^ ]/ { |
7 commands==1 && /^ [^ ]/ { |
8 sub(/ /, "") |
8 line = substr($0, 2) |
9 sub(/:.*/, "") |
9 colon = index(line, ":") |
10 command = $1 |
10 if (colon > 0) |
|
11 line = substr(line, 1, colon-1) |
|
12 n = split(line, aliases) |
|
13 command = aliases[1] |
11 if (index(command, "debug") == 1) { |
14 if (index(command, "debug") == 1) { |
12 for (i=1; i<=NF; i++) |
15 for (i=1; i<=n; i++) |
13 debug[j++] = $i |
16 debug[j++] = aliases[i] |
14 next |
17 next |
15 } |
18 } |
16 print command |
19 print command |
17 for (i=2; i<=NF; i++) |
20 for (i=2; i<=n; i++) |
18 if (index(command, $i) != 1) |
21 if (index(command, aliases[i]) != 1) |
19 print $i |
22 print aliases[i] |
20 } |
23 } |
21 /^global options:/ {exit 0} |
24 /^global options:/ {exit 0} |
22 END {for (i in debug) print debug[i]}' |
25 END {for (i in debug) print debug[i]}' |
23 } |
26 } |
24 |
27 |