diff contrib/bash_completion @ 2034:5e7aff1b6ae1

add --options to debugcomplete and change bash_completion to use it make debugcomplete print one item per line (this is not needed for the bash_completion script, but should be easier to use in other scripts)
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 01 Apr 2006 22:50:12 +0200
parents 283d2ab1e020
children 107dc72880f8
line wrap: on
line diff
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -1,18 +1,5 @@
 shopt -s extglob
 
-_hg_option_list()
-{
-    "$hg" -v help $1 2>/dev/null | \
-	awk '/^ *-/ {
-		for (i = 1; i <= NF; i ++) {
-		    if (index($i, "-") != 1)
-			break;
-		    print $i;
-		}
-	    }'
-}
-
-
 _hg_commands()
 {
     local commands
@@ -89,7 +76,7 @@ shopt -s extglob
     done
 
     if [[ "$cur" == -* ]]; then
-	opts=$(_hg_option_list $cmd)
+	opts=$("$hg" debugcomplete --options "$cmd" 2>/dev/null)
 
 	COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
 	return