Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Silly questions about _arguments & Co (and probably bugs)
- X-seq: zsh-workers 7744
- From: Tanaka Akira <akr@xxxxxxxxxxx>
- To: "ZSH workers mailing list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: Silly questions about _arguments & Co (and probably bugs)
- Date: 09 Sep 1999 22:54:03 +0900
- In-reply-to: "Andrej Borsenkow"'s message of "Thu, 9 Sep 1999 17:13:52 +0400"
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <001101befac5$29ae4260$21c9ca95@xxxxxxxxxxxxxx>
In article <001101befac5$29ae4260$21c9ca95@xxxxxxxxxxxxxx>,
"Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author