changeset 3480:03932425cfd8

bash_completion: don't complete export with "garbage" when mq is not around The "garbage" is the output of hg help printed when a command is not found.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 22 Oct 2006 01:01:03 -0300
parents bbfb392b2b1a
children 13a9a2136dd7
files contrib/bash_completion
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/bash_completion	Sat Oct 21 20:51:24 2006 +0200
+++ b/contrib/bash_completion	Sun Oct 22 01:01:03 2006 -0300
@@ -251,8 +251,13 @@
 # mq
 _hg_ext_mq_patchlist()
 {
-    local patches=$("$hg" $1 2>/dev/null)
-    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur"))
+    local patches
+    patches=$("$hg" $1 2>/dev/null)
+    if [ $? -eq 0 ] && [ "$patches" ]; then
+	COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur"))
+	return 0
+    fi
+    return 1
 }
 
 _hg_ext_mq_queues()