bash_completion: 'fucntion' keyword' not supported

TK Soh teekaysoh at yahoo.com
Thu Mar 2 10:07:25 UTC 2006


--- "Alexis S. L. Carvalho" <alexis at cecm.usp.br> wrote:
> For some reason, this filtering is still not happening on Solaris and I
> really don't know why - that part of the code is pretty similar to the
> part that filters debug commands, and it looks like that one is
> working... :-/

Looks like multi-character FS isn't supported either :(

Perhaps you should think about switching to nawk, thought I'm sure it isn't completely free of
troubles. Meantime, try the following hack:

diff -r a9343f9d7365 contrib/bash_completion
--- a/contrib/bash_completion	Thu Mar 02 09:17:04 2006 +0100
+++ b/contrib/bash_completion	Thu Mar 02 17:52:16 2006 +0800
@@ -3,13 +3,13 @@ _hg_command_list()
 _hg_command_list()
 {
     "$hg" --debug help 2>/dev/null | \
-	awk -F', ' '/^list of commands:/ {commands=1}
+	awk '/^list of commands:/ {commands=1}
 	    commands==1 && /^ [^ ]/ {
 		line = substr($0, 2)
 		colon = index(line, ":")
 		if (colon > 0)
 		    line = substr(line, 1, colon-1)
-		n = split(line, aliases)
+		n = split(line, aliases, ",")
 		command = aliases[1]
 		if (index(command, "debug") == 1) {
 		    for (i=1; i<=n; i++)
@@ -17,9 +17,15 @@ _hg_command_list()
 		    next
 		}
 		print command
-		for (i=2; i<=n; i++)
+		for (i=2; i<=n; i++) {
+		    # strip leading white space
+		    space = index(aliases[i], " ")
+		    if (space > 0)
+		        aliases[i] = substr(aliases[i], space+1)
+                    
 		    if (index(command, aliases[i]) != 1)
 			print aliases[i]
+                }
 	    }
 	    /^global options:/ {exit 0}
 	    END {for (i in debug) print debug[i]}'


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Mercurial mailing list