From: "Jörg Sommer" <joerg@alea.gnuu.de>
To: zsh-workers@sunsite.dk
Subject: Improve completion of modprobe module parameters
Date: Mon, 22 Sep 2008 16:55:11 +0000 (UTC) [thread overview]
Message-ID: <slrngdfjfe.1rn.joerg@alea.gnuu.de> (raw)
Hi,
commit e19e7fa39f7dcd9de4cb42463f142f7ff2483936
Author: Jörg Sommer <joerg@alea.gnuu.de>
Date: Mon Sep 22 18:24:47 2008 +0200
Add the option --field of modinfo
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 7322903..7cc539f 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -18,6 +18,8 @@ case "$service" in
'(-)'{-l,--license}"[display the module's license]" \
'(-)'{-n,--filename}"[display the module's filename]" \
'(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \
+ '(-)'{-F,--field}"[display only selected module's information]:module_field:(
+ alias author depends description filename license parm)" \
'1:module file:->all_modules' && ret=0
;;
commit d682cfc8640bfc6bd706cb8d113db1d1d7ee9de5
Author: Jörg Sommer <joerg@alea.gnuu.de>
Date: Mon Sep 22 18:27:02 2008 +0200
Return 0 if a modules parameter was completed
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 7cc539f..e2efb53 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -88,7 +88,7 @@ case "$state" in
_message -e value 'parameter value'
else
_values 'module parameter' \
- ${(f)^"$(_call_program module_parameter modinfo -F parm "$words[2]" 2>/dev/null)"//:/\=[}\]
+ ${(f)^"$(_call_program module_parameter modinfo -F parm "$words[2]" 2>/dev/null)"//:/\=[}\] && ret=0
fi
;;
esac
commit 4be6a9fffb837f7647a3a836589870d150149593
Author: Jörg Sommer <joerg@alea.gnuu.de>
Date: Mon Sep 22 18:29:28 2008 +0200
Declare val_args as local array
As requested in the documention of _values in zshcompsys(1), declare the
array as local.
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index e2efb53..5b063e4 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -87,6 +87,8 @@ case "$state" in
if compset -P '*='; then
_message -e value 'parameter value'
else
+ typeset -A val_args
+
_values 'module parameter' \
${(f)^"$(_call_program module_parameter modinfo -F parm "$words[2]" 2>/dev/null)"//:/\=[}\] && ret=0
fi
commit 0e0292d0b0068e521e7fe8ebedd36fd2c1631b2f
Author: Jörg Sommer <joerg@alea.gnuu.de>
Date: Mon Sep 22 18:33:44 2008 +0200
Improve module parameter completion
First, do not embedd the = in the parameter by define it a
parameter‐value separator; -S =.
Second, look for already given parameters in all words; -w.
Third, use the curcontext variable; -C.
Forth, distinct between boolean and non‐boolean parameters, i.e. do not
append a = to the end. And include the type of the parameter in the help
message. This information is only given in the full output of modinfo,
not in the narrowed output with --field.
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 5b063e4..f422fac 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -87,10 +87,17 @@ case "$state" in
if compset -P '*='; then
_message -e value 'parameter value'
else
- typeset -A val_args
+ local params
+ params=( ${${(M)${(f)"$(_call_program module_parameter modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} )
+ if [[ $#params -eq 0 ]]; then
+ _message -e parameter "This modules doesn't have parameters"
+ else
+ typeset -A val_args
- _values 'module parameter' \
- ${(f)^"$(_call_program module_parameter modinfo -F parm "$words[2]" 2>/dev/null)"//:/\=[}\] && ret=0
+ _values -S = -C -w 'module parameter' \
+ ${${${(M)params:#*(:bool|\(bool\))}/:/[}/(bool| \(bool\))/]} \
+ ${^${params:#*(:bool|\(bool\))}/:/[}"]:auto added argument: " && ret=0
+ fi
fi
;;
esac
Bye, Jörg.
--
Fazit: „Schießen Sie nicht mit dem Geiger!“
<news:46778c4c$0$6396$9b4e6d93@newsspool2.arcor-online.net>
reply other threads:[~2008-09-22 17:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=slrngdfjfe.1rn.joerg@alea.gnuu.de \
--to=joerg@alea.gnuu.de \
--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).