changeset 1150:4ee09418c8e5

bash_completion: better handling of aliases Instead of listing every alias in the big case..esac, use hg help to get the canonical name of the command.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 29 Aug 2005 20:37:07 +0200
parents f82b084bd904
children 10b4f2a5ce17
files contrib/bash_completion
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/bash_completion	Mon Aug 29 20:37:07 2005 +0200
+++ b/contrib/bash_completion	Mon Aug 29 20:37:07 2005 +0200
@@ -90,6 +90,9 @@
 	return
     fi
 
+    # canonicalize command name
+    cmd=$(hg -q help "$cmd" | sed -e 's/^hg //; s/ .*//; 1q')
+
     if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
 	_hg_tags
 	return
@@ -99,10 +102,10 @@
 	help)
 	    _hg_commands
 	;;
-	export|manifest|update|checkout|up|co)
+	export|manifest|update)
 	    _hg_tags
 	;;
-	pull|push|outgoing|incoming|out|in)
+	pull|push|outgoing|incoming)
 	    _hg_paths
 	    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -d -- "$cur" ))
 	;;
@@ -112,7 +115,7 @@
 	add)
 	    _hg_status "u"
 	;;
-	commit|ci)
+	commit)
 	    _hg_status "mra"
 	;;
 	remove)