summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Luttringer <seblu@seblu.net>2011-06-27 00:20:55 +0200
committerThomas Bächler <thomas@archlinux.org>2011-06-27 20:41:20 +0200
commita745dc047d103547bed4af97c376a93fd8e3d08a (patch)
tree4a065eec4f0f9c9519d025743fb93dd9ee9cb87a
parenta5eb24e544576b23e842874f510c2a7811e95ea3 (diff)
downloadmkinitcpio-a745dc047d103547bed4af97c376a93fd8e3d08a.tar.gz
mkinitcpio-a745dc047d103547bed4af97c376a93fd8e3d08a.tar.xz
Use _get_comp_words_by_ref in bash completion
Thanks Dave Reisner for suggestion Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
-rw-r--r--bash-completion16
1 files changed, 8 insertions, 8 deletions
diff --git a/bash-completion b/bash-completion
index 889dc41..f4f8181 100644
--- a/bash-completion
+++ b/bash-completion
@@ -2,10 +2,10 @@
_lsinitcpio ()
{
- local action="-a -h -v -x"
- local cur="${COMP_WORDS[COMP_CWORD]}"
- local caction="${COMP_WORDS[COMP_CWORD]}"
- case "$caction" in
+ local action cur
+ action="-a -h -v -x"
+ _get_comp_words_by_ref cur
+ case "$cur" in
-*) COMPREPLY=($(compgen -W "${action}" -- "$cur"));;
*) _filedir;;
esac
@@ -13,10 +13,10 @@ _lsinitcpio ()
_mkinitcpio ()
{
- local action="-c -k -s -b -g -p -S -v -M -L -H -h"
- local cur="${COMP_WORDS[COMP_CWORD]}"
- local caction="${COMP_WORDS[COMP_CWORD-1]}"
- case "$caction" in
+ local action cur prev
+ action="-c -k -s -b -g -p -S -v -M -L -H -h"
+ _get_comp_words_by_ref cur prev
+ case "$prev" in
-c|-g) _filedir;;
-k) COMPREPLY=($(cd /lib/modules && compgen -d -- $cur));;
-b) COMPREPLY=($(compgen -d "$cur" -- $cur));;