mirror of
git://git.code.sf.net/p/zsh/code
synced 2026-01-04 09:01:06 +01:00
14341: modprobe -r / rmmod completion
This commit is contained in:
parent
ea03bf1ae5
commit
6f17b7c2e2
3 changed files with 52 additions and 1 deletions
|
|
@ -1,3 +1,10 @@
|
|||
2001-05-15 Clint Adams <clint@zsh.org>
|
||||
|
||||
* 14341: Completion/Unix/Command/.distfiles,
|
||||
Completion/Unix/Command/_modutils:
|
||||
complete loaded Linux kernel modules for
|
||||
rmmod or modprobe -r.
|
||||
|
||||
2001-05-14 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 14330: Completion/Base/Widget/_most_recent_file: handle filenames
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ _cvs _gnu_generic _ls _perl _tar _zip
|
|||
_dd _gprof _lynx _perldoc _telnet _pine
|
||||
_dict _grep _lzop _prcs _tiff _elm
|
||||
_diff _gs _make _psutils _tin _apm _mail
|
||||
_loadkeys
|
||||
_loadkeys _modutils
|
||||
'
|
||||
|
|
|
|||
44
Completion/Unix/Command/_modutils
Executable file
44
Completion/Unix/Command/_modutils
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#compdef modprobe rmmod
|
||||
|
||||
local loaded
|
||||
|
||||
_modutils_loaded_modules() {
|
||||
|
||||
if [[ -f /proc/modules ]]; then
|
||||
loaded=(${${(f)"$(</proc/modules)"}%% *})
|
||||
elif [[ -x /sbin/lsmod ]]; then
|
||||
loaded=(${${${(f)"$(</sbin/lsmod)"}%% *}%Module})
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
compadd -a loaded
|
||||
return 0
|
||||
}
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue