bash_completion: ignore hg help error messages
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Fri, 27 Jan 2006 12:15:39 +0100
changeset 1643 747c8d03bd29
parent 1642 b8d792057e5b
child 1644 e7e6504c4989
bash_completion: ignore hg help error messages They are usually not useful when you're completing stuff and end up cluttering the screen.
contrib/bash_completion
--- a/contrib/bash_completion	Fri Jan 27 12:11:14 2006 +0100
+++ b/contrib/bash_completion	Fri Jan 27 12:15:39 2006 +0100
@@ -56,7 +56,7 @@
 
 _hg_paths()
 {
-    local paths="$(hg paths | sed -e 's/ = .*$//')"
+    local paths="$(hg paths 2> /dev/null | sed -e 's/ = .*$//')"
     COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$paths' -- "$cur" ))
 }
 
@@ -70,13 +70,14 @@
 
 _hg_status()
 {
-    local files="$( hg status -n$1 . )"
+    local files="$( hg status -n$1 . 2> /dev/null)"
     COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$files' -- "$cur" ))
 }
 
 _hg_tags()
 {
-    local tags="$(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
+    local tags="$(hg tags 2> /dev/null |
+                      sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
     COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") )
 }
 
@@ -145,7 +146,7 @@
     fi
 
     # canonicalize command name
-    cmd=$(hg -q help "$cmd" | sed -e 's/^hg //; s/ .*//; 1q')
+    cmd=$(hg -q help "$cmd" 2> /dev/null | sed -e 's/^hg //; s/ .*//; 1q')
 
     if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
 	_hg_tags