Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: rmmod/modprobe -r completion
- X-seq: zsh-workers 14361
- From: Clint Adams <clint@xxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- Subject: Re: PATCH: rmmod/modprobe -r completion
- Date: Wed, 16 May 2001 08:00:47 -0400
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <3B014622.7EE4888@xxxxxxxxxxxxx>; from opk@xxxxxxxxxxxxx on Tue, May 15, 2001 at 04:07:14PM +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20010514222601.A18298@xxxxxxxx> <3B014622.7EE4888@xxxxxxxxxxxxx>
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author