equal
deleted
inserted
replaced
1 shopt -s extglob |
1 shopt -s extglob |
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 'function command_line(line) { |
6 awk -F', ' '/^list of commands:/ {commands=1} |
7 gsub(/,/, "", line) |
7 commands && /^ [^ ]/ { |
8 gsub(/:.*/, "", line) |
8 sub(/ /, "") |
9 split(line, aliases) |
9 sub(/:.*/, "") |
10 command = aliases[1] |
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 in aliases) |
17 for (i=2; i<=NF; i++) |
14 if (index(command, aliases[i]) != 1) |
18 if (index(command, $i) != 1) |
15 print aliases[i] |
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 a) command_line(a[i])}' |
22 END {for (i in debug) print debug[i]}' |
22 |
|
23 } |
23 } |
24 |
24 |
25 _hg_option_list() |
25 _hg_option_list() |
26 { |
26 { |
27 "$hg" -v help $1 2>/dev/null | \ |
27 "$hg" -v help $1 2>/dev/null | \ |