summaryrefslogtreecommitdiffstats
path: root/bash-completion
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-04-18 01:23:15 +0200
committerDave Reisner <dreisner@archlinux.org>2012-04-22 05:43:52 +0200
commitfa5484c81c40e0a5a05194909600716f39ce0faf (patch)
tree8d83ec1e2a9dd68e4031696008a24f14a00512d5 /bash-completion
parent5d62de59adfa8e6b7c19c418effc8757637c702e (diff)
downloadmkinitcpio-fa5484c81c40e0a5a05194909600716f39ce0faf.tar.gz
mkinitcpio-fa5484c81c40e0a5a05194909600716f39ce0faf.tar.xz
mkinitcpio: adopt parseopts for option parsing
Updates the doc and bash-completion, as well. Also adds the previously unmentioned -A option to the --help output. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
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
}