* [PATCH 1/4] Add the option --field of modinfo
@ 2008-10-06 22:58 Jörg Sommer
2008-10-06 22:58 ` [PATCH 2/4] Return 0 if a modules parameter was completed Jörg Sommer
0 siblings, 1 reply; 4+ messages in thread
From: Jörg Sommer @ 2008-10-06 22:58 UTC (permalink / raw)
To: zsh-workers; +Cc: Jörg Sommer
---
Completion/Linux/Command/_modutils | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index e03b471..2ba43a7 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
;;
--
1.6.0.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/4] Return 0 if a modules parameter was completed
2008-10-06 22:58 [PATCH 1/4] Add the option --field of modinfo Jörg Sommer
@ 2008-10-06 22:58 ` Jörg Sommer
2008-10-06 22:58 ` [PATCH 3/4] Declare val_args as local array Jörg Sommer
0 siblings, 1 reply; 4+ messages in thread
From: Jörg Sommer @ 2008-10-06 22:58 UTC (permalink / raw)
To: zsh-workers; +Cc: Jörg Sommer
---
Completion/Linux/Command/_modutils | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 2ba43a7..91dff4b 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -96,7 +96,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
--
1.6.0.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] Declare val_args as local array
2008-10-06 22:58 ` [PATCH 2/4] Return 0 if a modules parameter was completed Jörg Sommer
@ 2008-10-06 22:58 ` Jörg Sommer
2008-10-06 22:58 ` [PATCH 4/4] Improve module parameter completion Jörg Sommer
0 siblings, 1 reply; 4+ messages in thread
From: Jörg Sommer @ 2008-10-06 22:58 UTC (permalink / raw)
To: zsh-workers; +Cc: Jörg Sommer
As requested in the documention of _values in zshcompsys(1), declare the
array as local.
---
Completion/Linux/Command/_modutils | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 91dff4b..faab852 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -95,6 +95,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
--
1.6.0.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] Improve module parameter completion
2008-10-06 22:58 ` [PATCH 3/4] Declare val_args as local array Jörg Sommer
@ 2008-10-06 22:58 ` Jörg Sommer
0 siblings, 0 replies; 4+ messages in thread
From: Jörg Sommer @ 2008-10-06 22:58 UTC (permalink / raw)
To: zsh-workers; +Cc: Jörg Sommer
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.
---
Completion/Linux/Command/_modutils | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index faab852..eefb11f 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -95,10 +95,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
--
1.6.0.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-06 23:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-06 22:58 [PATCH 1/4] Add the option --field of modinfo Jörg Sommer
2008-10-06 22:58 ` [PATCH 2/4] Return 0 if a modules parameter was completed Jörg Sommer
2008-10-06 22:58 ` [PATCH 3/4] Declare val_args as local array Jörg Sommer
2008-10-06 22:58 ` [PATCH 4/4] Improve module parameter completion Jörg Sommer
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).