mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 21:44:11 +01:00
44 lines
1.1 KiB
Plaintext
Executable File
44 lines
1.1 KiB
Plaintext
Executable File
#compdef modprobe rmmod
|
|
|
|
local expl loaded
|
|
|
|
_modutils_loaded_modules() {
|
|
|
|
if [[ -r /proc/modules ]]; then
|
|
loaded=(${${(f)"$(</proc/modules)"}%% *})
|
|
elif [[ -x /sbin/lsmod ]]; then
|
|
loaded=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *})
|
|
else
|
|
return 1
|
|
fi
|
|
|
|
_wanted modules expl 'loaded module' compadd -a loaded
|
|
}
|
|
|
|
case "$service" in
|
|
rmmod)
|
|
|
|
_arguments '(--all)-a[remove all unused autocleanable modules]' \
|
|
'(-a)--all' \
|
|
'(--persist)-e[save persistent data]' \
|
|
'(-e)--persist' \
|
|
'(--help)-h[print help text]' \
|
|
'(-h)--help' \
|
|
'(--stacks)-r[remove a module stack]' \
|
|
'(-r)--stacks' \
|
|
'(--syslog)-s[output to syslog]' \
|
|
'(-s)--syslog' \
|
|
'(--verbose)-v[be verbose]' \
|
|
'(-v)--verbose' \
|
|
'(--version)-V[print version]' \
|
|
'(-V)--version' \
|
|
'*:loaded module:_modutils_loaded_modules'
|
|
;;
|
|
|
|
modprobe)
|
|
_arguments '(--remove)-r[remove]:loaded module:_modutils_loaded_modules' \
|
|
'(-r)--remove:loaded module:_modutils_loaded_modules'
|
|
;;
|
|
|
|
esac
|