Mercurial > hg
changeset 1820:7e10518b2b9e
Really fix bash_completion on Solaris. Maybe. Hopefully.
Use substr instead of sub.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Wed, 01 Mar 2006 14:52:28 +0100 |
parents | d657bfdc06c4 |
children | 0b3f4be5c5bf |
files | contrib/bash_completion |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/bash_completion Wed Mar 01 09:19:27 2006 +0100 +++ b/contrib/bash_completion Wed Mar 01 14:52:28 2006 +0100 @@ -4,19 +4,22 @@ { "$hg" --debug help 2>/dev/null | \ awk -F', ' '/^list of commands:/ {commands=1} - commands && /^ [^ ]/ { - sub(/ /, "") - sub(/:.*/, "") - command = $1 + commands==1 && /^ [^ ]/ { + line = substr($0, 2) + colon = index(line, ":") + if (colon > 0) + line = substr(line, 1, colon-1) + n = split(line, aliases) + command = aliases[1] if (index(command, "debug") == 1) { - for (i=1; i<=NF; i++) - debug[j++] = $i + for (i=1; i<=n; i++) + debug[j++] = aliases[i] next } print command - for (i=2; i<=NF; i++) - if (index(command, $i) != 1) - print $i + for (i=2; i<=n; i++) + if (index(command, aliases[i]) != 1) + print aliases[i] } /^global options:/ {exit 0} END {for (i in debug) print debug[i]}'