zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: rmmod/modprobe -r completion
@ 2001-05-15  2:26 Clint Adams
  2001-05-15 15:07 ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2001-05-15  2:26 UTC (permalink / raw)
  To: zsh-workers

This lacks all the other options to modprobe, and ignores
insmod, but it seemed silly to just do rmmod and not have it work
for modprobe -r.

Index: Completion/Unix/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/.distfiles,v
retrieving revision 1.4
diff -u -r1.4 .distfiles
--- Completion/Unix/Command/.distfiles	2001/05/03 13:05:49	1.4
+++ Completion/Unix/Command/.distfiles	2001/05/15 02:17:10
@@ -14,5 +14,5 @@
 _dd           _gprof        _lynx         _perldoc      _telnet       _pine
 _dict         _grep         _lzop         _prcs         _tiff         _elm
 _diff         _gs           _make         _psutils      _tin	_apm  _mail
-_loadkeys
+_loadkeys     _modutils
 '
Index: Completion/Unix/Command/_modutils
===================================================================
RCS file: _modutils
diff -N _modutils
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _modutils	Mon May 14 19:17:10 2001
@@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-16 12:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15  2:26 PATCH: rmmod/modprobe -r completion Clint Adams
2001-05-15 15:07 ` Oliver Kiddle
2001-05-16 12:00   ` Clint Adams
2001-05-16 12:32     ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).