diff options
author | Dave Reisner <dreisner@archlinux.org> | 2011-11-13 04:58:15 +0100 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2011-11-13 04:58:15 +0100 |
commit | 81725e6ff3bbde89fc10fb8f25e78ee67074ae25 (patch) | |
tree | c9336c9c95e86c470362e7cf0c1126f0b69415bb /bash-completion | |
parent | 7eb9355b98ffb5e47b0b1cdc524ff4679cd77327 (diff) | |
download | mkinitcpio-81725e6ff3bbde89fc10fb8f25e78ee67074ae25.tar.gz mkinitcpio-81725e6ff3bbde89fc10fb8f25e78ee67074ae25.tar.xz |
update bash completion
- change scavenging of /lib/modules to avoid grabbing extramodules dirs
- add missing options for lsinitcpio and mkinitcpio
- use _filedir for completing -b
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'bash-completion')
-rw-r--r-- | bash-completion | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bash-completion b/bash-completion index 8caff93..ee544ec 100644 --- a/bash-completion +++ b/bash-completion @@ -3,7 +3,7 @@ _lsinitcpio() { local action cur - action="-a -h -v -x" + action="-a -h -n -v -x" _get_comp_words_by_ref cur case "$cur" in -*) COMPREPLY=($(compgen -W "${action}" -- "$cur"));; @@ -15,24 +15,30 @@ _find_kernel_versions() { local -a matches local regex + # add completions from kernels in /boot regex="Linux kernel.*version" while IFS=':' read -r file metadata; do [[ $metadata =~ $regex ]] || continue matches+=("$file") done < <(file -e ascii /boot/*) - COMPREPLY=($(cd /lib/modules && compgen -d -- $cur) - $(compgen -W "${matches[*]}" -- $cur)) + # add completions based on kernel versions in /lib/modules + for dir in /lib/modules/*/kernel; do + dir=${dir%/kernel} + matches+=("${dir#/lib/modules/}") + done + + COMPREPLY=($(compgen -W "${matches[*]}" -- $cur)) } _mkinitcpio() { local action cur prev - action="-c -k -s -b -g -p -S -v -M -L -H -h" + action="-b -c -g -H -h -k -L -M -n -p -S -s -v -z" _get_comp_words_by_ref cur prev case "$prev" in -c|-g) _filedir;; -k) _find_kernel_versions;; - -b) COMPREPLY=($(compgen -d "$cur" -- $cur));; + -b) _filedir -d;; -p) COMPREPLY=($(cd /etc/mkinitcpio.d/ && compgen -X '!*.preset' -f -- $cur)) COMPREPLY=("${COMPREPLY[@]%.preset}");; -H|-S) COMPREPLY=($(cd /lib/initcpio/install/ && compgen -f -- $cur));; |