From fa5484c81c40e0a5a05194909600716f39ce0faf Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 17 Apr 2012 19:23:15 -0400 Subject: 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 --- bash-completion | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'bash-completion') 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 } -- cgit v1.2.3-24-g4f1b