diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2011-04-20 22:42:55 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-04-20 22:42:55 +0300 |
commit | 0cb626342442fc451f6cca5b92e0d162c9fa478e (patch) | |
tree | c0a117884fb16ed91edc467cb63fcec4e3f5f491 /completions/module-init-tools | |
parent | 69ecdc49d53e68842efb68c0621d9566f07d0a68 (diff) | |
download | bash-completion-0cb626342442fc451f6cca5b92e0d162c9fa478e.tar.gz |
Use _init_completion() in completions/m*.
Diffstat (limited to 'completions/module-init-tools')
-rw-r--r-- | completions/module-init-tools | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/completions/module-init-tools b/completions/module-init-tools index bf2d24d1..fcef11c0 100644 --- a/completions/module-init-tools +++ b/completions/module-init-tools @@ -6,10 +6,8 @@ have rmmod && _rmmod() { - local cur - - COMPREPLY=() - _get_comp_words_by_ref cur + local cur prev words cword + _init_completion || return _installed_modules "$cur" return 0 @@ -23,13 +21,11 @@ complete -F _rmmod rmmod have insmod || have modprobe || have modinfo && _insmod() { - local cur prev modpath - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return # behave like lsmod for modprobe -r - if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then + if [[ ${1##*/} == modprobe && "${words[1]}" == -r ]]; then _installed_modules "$cur" return 0 fi @@ -40,9 +36,9 @@ _insmod() return 0 fi - if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then + if [[ $cword -gt 1 && "${words[cword-1]}" != -* ]]; then # do module parameter completion - COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${COMP_WORDS[1]} | \ + COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${words[1]} | \ cut -d: -f1 )" -- "$cur" ) ) else _modules $(uname -r) |