From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10824 invoked from network); 9 Sep 1999 13:54:40 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Sep 1999 13:54:40 -0000 Received: (qmail 9889 invoked by alias); 9 Sep 1999 13:54:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7744 Received: (qmail 9856 invoked from network); 9 Sep 1999 13:54:09 -0000 To: "ZSH workers mailing list" Subject: Re: Silly questions about _arguments & Co (and probably bugs) References: <001101befac5$29ae4260$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 (generated by AKEMI 1.13.2 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCQTA0Y0s8GyhCIg==?=) Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 09 Sep 1999 22:54:03 +0900 In-Reply-To: "Andrej Borsenkow"'s message of "Thu, 9 Sep 1999 17:13:52 +0400" Message-ID: User-Agent: Chao-gnus/6.12.5 AKEMI/1.13.2 (=?ISO-2022-JP?B?GyRCQTAbKEI=?= =?ISO-2022-JP?B?GyRCNGNLPBsoQg==?=) FLAM-DOODLE/1.12.6 (=?ISO-2022-JP?B?GyRCM3cbKEI=?= 10R4.0/5.0) Emacs/20.4 (sparc-sun-solaris2.6) MULE/4.0 (HANANOEN) In article <001101befac5$29ae4260$21c9ca95@mow.siemens.ru>, "Andrej Borsenkow" writes: > Forgive me, but I recently had no time to follow all discussions and do not > quite understand the manual description. > > 1. When are the description of arguments actually printed? I tried some basic > commands like xterm or patch but descriptions do not seem to be printed. Use following. % compconf group_matches=yes message_format='%d' description_format='%d' describe_options=yes If it is too verbose, also use following. % compconf option_prefix=all > 3. I cannot make completion for patch work. As simple as `patch --sTAB' just > beeps. Probably this is because the help text of patch command is not suited for _arguments. the help text of patch-2.5.4 contains: -p NUM --strip=NUM Strip NUM leading components from file names. -F LINES --fuzz LINES Set the fuzz factor to LINES for inexact matching. Although I suppose that it is possible to handle `--strip=NUM', but `--fuzz LINES' are very difficult. So, I modified the help text. http://www.ldl.jaist.ac.jp/~akr/junk/patch-2.5.4-akr-19990902.patch # This patch also contains other functionality. If you have trouble to # apply my patches, please try it and use --use-index-line. > 4. `patch -pTAB' gives me `patch -p0 ' - but `0' is not autoremoved if I enter > different number (I'd expect it to be). I see. > 5. `patch TAB' does not list most of the long options at all. Actually, it is > interesting case - if a command has both long and short form - which one should > be preferred? I'd like to have short option only if no corresponding short one > exists. This is caused by the help text handling failure. Currently _arguments doesn't handle preferences of options, I think. Index: Completion/User/_patch =================================================================== RCS file: /projects/zsh/zsh/Completion/User/_patch,v retrieving revision 1.1.1.4 diff -u -F^( -r1.1.1.4 _patch --- _patch 1999/09/07 12:55:07 1.1.1.4 +++ _patch 1999/09/09 13:48:27 @@ -1,7 +1,9 @@ #compdef patch +local comp_p='compadd "$expl[@]" -S0 -r "1-9" - ""' + _arguments -s \ - '(--strip)-p+:number:(0)' \ + '(--strip)-p+:number:'"{$comp_p}" \ '(--fuzz)-F+:lines:' \ '(--context)-c' \ '(--ed)-e' \ @@ -30,7 +32,8 @@ ':original file:_files' \ ':patch file:_files' \ -- \ - '*=NUM*:number:(0)' \ + '*strip=NUM*:number:'"{$comp_p}" \ + '*get=NUM*:get files from RCS etc:' \ '*=LINES*:lines:' \ '*=PATCHFILE*:patch file:_files' \ '*=FILE*:file:_files' \ -- Tanaka Akira