From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25129 invoked from network); 22 Sep 2008 17:10:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 22 Sep 2008 17:10:09 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 38348 invoked from network); 22 Sep 2008 17:09:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 Sep 2008 17:09:36 -0000 Received: (qmail 18265 invoked by alias); 22 Sep 2008 17:09:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25716 Received: (qmail 18245 invoked from network); 22 Sep 2008 17:09:27 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 22 Sep 2008 17:09:27 -0000 Received: from uucp.gnuu.de (banki.eumelnet.de [83.246.114.63]) by bifrost.dotsrc.org (Postfix) with ESMTP id 1F1F4805897D for ; Mon, 22 Sep 2008 19:08:51 +0200 (CEST) Received: by uucp.gnuu.de (Postfix, from userid 10) id 0B999EC054; Mon, 22 Sep 2008 19:08:14 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.5.2 uucp.gnuu.de 0B999EC054 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=gnuu.de; s=banki; t=1222103295; i=@alea.gnuu.de; bh=QhPD5hYFgUpkR+VKECLNtdHmt1bJwjqKu JWkby39v1M=; h=To:From:Subject:Date:Message-ID:Mime-Version: Content-Type:Content-Transfer-Encoding:Sender; b=VwjX+q8xLtt4sThA2 v959eDjuzF4FikTSk8wBK7xHMWG1jLa6VcZccUQ0qGLFD7i4JWMMT7HWguK8lB0zuwo wN1UGo+JkjVKm55nSAmciFJLKePvPl9mb5BZzXtIk3plta9XxhT2kLTmfi09zvz51Qo Z7UuDaJLtz++yAcNh/mw= Received: from news by alea.gnuu.de with local (Exim 4.63) (envelope-from ) id 1Khogp-0004BR-5p for zsh-workers@sunsite.dk; Mon, 22 Sep 2008 18:55:11 +0200 To: zsh-workers@sunsite.dk Path: not-for-mail From: =?UTF-8?Q?J=C3=B6rg?= Sommer Newsgroups: local.mailinglist.zsh Subject: Improve completion of modprobe module parameters Date: Mon, 22 Sep 2008 16:55:11 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: alea.gnuu.de 1222102511 16077 192.168.0.5 (22 Sep 2008 16:55:11 GMT) X-Complaints-To: usenet@alea.gnuu.de User-Agent: slrn/0.9.9 (Linux) Sender: news X-Virus-Scanned: ClamAV 0.92.1/8308/Mon Sep 22 15:43:13 2008 on bifrost X-Virus-Status: Clean Hi, commit e19e7fa39f7dcd9de4cb42463f142f7ff2483936 Author: Jörg Sommer 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 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 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 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!“