zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@jaist.ac.jp>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: Re: Silly questions about _arguments & Co (and probably bugs)
Date: 09 Sep 1999 22:54:03 +0900	[thread overview]
Message-ID: <rsqwvu0nqbo.fsf@crane.jaist.ac.jp> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of "Thu, 9 Sep 1999 17:13:52 +0400"

In article <001101befac5$29ae4260$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> 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


  reply	other threads:[~1999-09-09 13:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-09 13:13 Andrej Borsenkow
1999-09-09 13:54 ` Tanaka Akira [this message]
1999-09-09 14:26   ` Andrej Borsenkow
1999-09-09 14:32     ` Tanaka Akira
1999-09-09 14:34       ` Andrej Borsenkow
1999-09-09 14:45         ` Tanaka Akira
1999-09-09 15:02           ` Andrej Borsenkow
1999-09-09 15:38   ` Option description and _oldlist Andrej Borsenkow
1999-09-09 13:55 Silly questions about _arguments & Co (and probably bugs) Sven Wischnowsky
1999-09-09 14:05 ` Andrej Borsenkow
1999-09-09 15:15 ` Andrej Borsenkow
1999-09-09 15:44   ` Tanaka Akira
1999-09-09 14:27 Sven Wischnowsky
1999-09-09 22:01 ` Tanaka Akira
1999-09-13 11:56 Sven Wischnowsky
1999-09-13 13:57 ` Tanaka Akira
1999-09-13 14:21 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=rsqwvu0nqbo.fsf@crane.jaist.ac.jp \
    --to=akr@jaist.ac.jp \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).