diff options
author | Clint Adams <clint@users.sourceforge.net> | 2001-05-15 02:32:51 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2001-05-15 02:32:51 +0000 |
commit | 6f17b7c2e225eacfeba20ba18e3842a1ecf90122 (patch) | |
tree | 145685e282b83456ade5c1fdb193b67039abfae0 /Completion/Unix/Command/_modutils | |
parent | ea03bf1ae558d76db45ad4cf2e0fa7c4b4836563 (diff) | |
download | zsh-6f17b7c2e225eacfeba20ba18e3842a1ecf90122.tar.gz zsh-6f17b7c2e225eacfeba20ba18e3842a1ecf90122.tar.xz zsh-6f17b7c2e225eacfeba20ba18e3842a1ecf90122.zip |
14341: modprobe -r / rmmod completion
Diffstat (limited to 'Completion/Unix/Command/_modutils')
-rwxr-xr-x | Completion/Unix/Command/_modutils | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_modutils b/Completion/Unix/Command/_modutils new file mode 100755 index 000000000..42481834b --- /dev/null +++ b/Completion/Unix/Command/_modutils @@ -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 |