[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 56996e5e6d0654f164f372a5511d9b0b9f17145e

Ville Skyttä ville.skytta at iki.fi
Sat Apr 18 19:41:56 UTC 2009


The following commit has been merged in the master branch:
commit 56996e5e6d0654f164f372a5511d9b0b9f17145e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Apr 18 22:41:48 2009 +0300

    Use compgen -W instead of grepping $cur.

diff --git a/contrib/mcrypt b/contrib/mcrypt
index 81f5d8b..8178b5b 100644
--- a/contrib/mcrypt
+++ b/contrib/mcrypt
@@ -18,24 +18,24 @@ _mcrypt()
 			return 0
 			;;
 		-@(o|-keymode))
-			COMPREPLY=( $( mcrypt --list-keymodes 2> /dev/null |
-				grep "^$cur" ) )
+			COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \
+				2>/dev/null )' -- $cur ) )
 			return 0
 			;;
 		-@(m|-mode))
-			COMPREPLY=( $( mcrypt --list 2> /dev/null |
-				sed -e 's/.*: //' -e 's/ $//' | sort |
-				uniq | tr " " "\n" | grep "^$cur" ) )
+			COMPREPLY=( $( compgen -W "$( mcrypt --list \
+				2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \
+				sort | uniq )" -- $cur ) )
 			return 0
 			;;
 		-@(a|-algorithm))
-			COMPREPLY=( $( mcrypt --list 2> /dev/null |
-				awk '{print $1}' | grep "^$cur" ) )
+			COMPREPLY=( $( compgen -W "$( mcrypt --list \
+				2>/dev/null | awk '{print $1}' )" -- $cur ) )
 			return 0
 			;;
 		-@(h|-hash))
-			COMPREPLY=( $( mcrypt --list-hash 2> /dev/null |
-				sed 1d | grep "^$cur" ) )
+			COMPREPLY=( $( compgen -W '$( mcrypt --list-hash \
+				2>/dev/null | sed -e 1d )' -- $cur ) )
 			return 0
 			;;
 		-@(k|s|-@(key?(size))))

-- 
bash-completion



More information about the Bash-completion-commits mailing list