From: Clint Adams <clint@zsh.org>
To: zsh-workers@sunsite.dk
Subject: PATCH: rmmod/modprobe -r completion
Date: Mon, 14 May 2001 22:26:01 -0400 [thread overview]
Message-ID: <20010514222601.A18298@dman.com> (raw)
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
next reply other threads:[~2001-05-15 2:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-15 2:26 Clint Adams [this message]
2001-05-15 15:07 ` Oliver Kiddle
2001-05-16 12:00 ` Clint Adams
2001-05-16 12:32 ` Clint Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010514222601.A18298@dman.com \
--to=clint@zsh.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).