summaryrefslogtreecommitdiffstats
path: root/bash-completion
diff options
context:
space:
mode:
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion33
1 files changed, 22 insertions, 11 deletions
diff --git a/bash-completion b/bash-completion
index b7fc277..f4c476b 100644
--- a/bash-completion
+++ b/bash-completion
@@ -32,18 +32,29 @@ _find_kernel_versions() {
}
_mkinitcpio() {
- local action cur prev
- action="-A -b -c -g -H -h -k -L -M -n -p -S -s -v -z"
+ local action cur prev opts
+ opts=(-A --add -b --basedir -c --config -g --generate -H --hookhelp
+ -h --help -k --kernel -L --listhooks -M --automods -n --nocolor
+ -p --preset -S --skiphooks -s --save -t --builddir -v --verbose
+ -z --compress)
+
_get_comp_words_by_ref cur prev
- case "$prev" in
- -c|-g) _filedir;;
- -k) _find_kernel_versions;;
- -b) _filedir -d;;
- -p) COMPREPLY=($(cd /etc/mkinitcpio.d/ && compgen -X '!*.preset' -f -- $cur))
- COMPREPLY=("${COMPREPLY[@]%.preset}");;
- -A|-H|-S) COMPREPLY=($(cd /lib/initcpio/install/ && compgen -f -- $cur) \
- $(cd /usr/lib/initcpio/install/ && compgen -f -- $cur));;
- *) COMPREPLY=($(compgen -W "${action}" -- "$cur"));;
+
+ case $prev in
+ -[cg]|--config|--generate)
+ _filedir ;;
+ -k|--kernel)
+ _find_kernel_versions ;;
+ -[bt]|--basedir|--builddir)
+ _filedir -d ;;
+ -p|--preset)
+ COMPREPLY=($(cd /etc/mkinitcpio.d/ && compgen -X '!*.preset' -f -- $cur))
+ COMPREPLY=("${COMPREPLY[@]%.preset}") ;;
+ -[AHS]|--add|--hookhelp|--skiphooks)
+ COMPREPLY=($(cd /lib/initcpio/install/ && compgen -f -- $cur)
+ $(cd /usr/lib/initcpio/install/ && compgen -f -- $cur)) ;;
+ *)
+ COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur")) ;;
esac
}