zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <clint@zsh.org>
To: Oliver Kiddle <opk@u.genie.co.uk>
Cc: zsh-workers@sunsite.dk
Subject: Re: PATCH: rmmod/modprobe -r completion
Date: Wed, 16 May 2001 08:00:47 -0400	[thread overview]
Message-ID: <20010516080047.A11461@dman.com> (raw)
In-Reply-To: <3B014622.7EE4888@u.genie.co.uk>; from opk@u.genie.co.uk on Tue, May 15, 2001 at 04:07:14PM +0100

> Hmm, this is fine but I'd have used a state or cached the loaded array
> and passed it to _arguments. Which is more efficient - functions
> declared in the autoloaded functions or states?

Well, modprobe could benefit from the use of states, so here's
modprobe supporting a few more options:


Index: Completion/Unix/Command/_modutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_modutils,v
retrieving revision 1.2
diff -u -r1.2 _modutils
--- Completion/Unix/Command/_modutils	2001/05/15 15:14:21	1.2
+++ Completion/Unix/Command/_modutils	2001/05/16 11:59:02
@@ -32,12 +32,37 @@
              '(-v)--verbose' \
              '(--version)-V[print version]' \
              '(-V)--version' \
-             '*:loaded module:_modutils_loaded_modules'
+             '*:loaded module:_modutils_loaded_modules' && return 0
   ;;
 
   modprobe)
-  _arguments '(--remove)-r[remove]:loaded module:_modutils_loaded_modules' \
-             '(-r)--remove:loaded module:_modutils_loaded_modules'
+
+  _modprobe_arguments=(
+             '(--all)-a[all]' \
+             '(-a)--all' \
+             '(--showconfig)-c[showconfig]' \
+             '(-c)--showconfig' \
+             '(--debug)-d[debug]' \
+             '(-d)--debug' \
+             '(--autoclean)-k[set autoclean]' \
+             '(-k)--autoclean' \
+             '(--show)-n[do not act]' \
+             '(-n)--show'
+  )
+
+  _arguments '(--remove)-r[remove]:*:loaded module:->modprobe_remove' \
+             '(-r)--remove:*:loaded module:->modprobe_remove' \
+	     "$_modprobe_arguments[@]" && return 0
+
+  ;;
+
+esac 
+
+case "$state" in
+  modprobe_remove)
+        _call_function ret _modutils_$state && return ret
+        _arguments "$_modprobe_arguments[@]" \
+                   '*:loaded module:_modutils_loaded_modules'
   ;;
 
 esac


  reply	other threads:[~2001-05-16 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-15  2:26 Clint Adams
2001-05-15 15:07 ` Oliver Kiddle
2001-05-16 12:00   ` Clint Adams [this message]
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=20010516080047.A11461@dman.com \
    --to=clint@zsh.org \
    --cc=opk@u.genie.co.uk \
    --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).