Use compgen -W instead of grepping $cur.

This commit is contained in:
Ville Skyttä 2009-04-18 22:41:48 +03:00
parent 2e66656e68
commit 56996e5e6d

View File

@ -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))))