Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 4/4] Improve module parameter completion
- X-seq: zsh-workers 25819
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: [PATCH 4/4] Improve module parameter completion
- Date: Tue, 7 Oct 2008 00:58:30 +0200
- Cc: Jörg Sommer <joerg@xxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=gnuu.de; s=banki; t=1223336526; i=@xxxxxxxxxxxx; bh=tGESiatd5SClo6RaloWuOltV23PR32P5G W81r11UUjM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding; b=r9VuoLuSF0mhUC3a6otYu0TUkkUwJxyy5LPBw9PuhCX+uQRAZF7g+j45iok+odVWG jkGnzOmjQ3sInlQT90NiMAkbQVGloceKw4eXnG+K3S6jDelC1uXCaNuBo3Qt4vU5EH9 2BfEBwaC15QLLIGquxp0DSnYV6O3L0qgXtnUYIA=
- In-reply-to: <1223333910-2641-3-git-send-email-joerg@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1223333910-2641-1-git-send-email-joerg@xxxxxxxxxxxx> <1223333910-2641-2-git-send-email-joerg@xxxxxxxxxxxx> <1223333910-2641-3-git-send-email-joerg@xxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author