zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: completion for perldoc
Date: Tue, 7 Sep 1999 10:32:00 +0200 (MET DST)	[thread overview]
Message-ID: <199909070832.KAA03607@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Adam Spiers's message of Mon, 6 Sep 1999 19:18:10 +0100


Adam Spiers wrote:

> Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> > Adam Spiers wrote:
> > > I noticed Etc/Completion-style-guide soon after posting and realised
> > > the many problems with that _perl* :-(
> > 
> > Never mind. All this isn't fixed in stone yet and the `style-guide' is 
> > quite new.
> 
> I've been uploading the style-guide and the _arguments documentation
> to my brain, and improved versions are on the way.  _arguments is
> great!  However a few things perplex me:
> 
> - Why can't you have multiple MESSAGE:ACTION pairs with the
>   *:MESSAGE:ACTION form?  I'm having to resort to using an auxiliary
>   function, e.g.:

There three forms that allow you to specify completion for
(non-option-) arguments:

  `num:mesg:action'
    specify completion for the num'th argument

  `:mesg:action'
    specify completion for the next argument (this is like the first
    one with `_argument' filling in the number automatically, for the
    cases where you just specify the completions for all arguments in
    the normal order one after another)

   `*:mesg:action'
     specify completion for `all other' arguments

These can be combined, of course:

  _arguments ':foo:(1 2)' '*:bar:(3 4)'

    completes `(1 2)' for the first argument and `(3 4)' for all other 
    arguments

  _arguments '2:foo:(1 2)' '*:bar:(3 4)'

    completes `(1 2)' for the *second* argument and `(3 4)' for all other 
    arguments


> - Is it possible to do something like (-foo)*:MESSAGE:ACTION, i.e.
>   specifying completion for normal args only if -foo hasn't been
>   specified?

There is no direct support for this. I'm not sure what you really want 
to have, but I think (or: hope) you can do it with:

  `-foo:*:mesg1:action1' '*:mesg2:action2'

    which makes *all* arguments after the option `-foo' be completed
    with `action1' (if that is empty, nothing will be completed, of
    course), and if `-foo' is not given, the second specification will 
    be used

This can then be used together with some trickery for `action1' to
achieve almost everything. If that is not enough or too clumsy to use, 
I'd like to see the real world example that made you wish for this.
And then I'll think about ways to make this easier.

Ok?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-09-07  8:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-07  8:32 Sven Wischnowsky [this message]
1999-09-07  9:49 ` Adam Spiers
  -- strict thread matches above, loose matches on Subject: below --
1999-09-07  9:02 Sven Wischnowsky
1999-09-07  8:59 Sven Wischnowsky
1999-09-06 11:37 Sven Wischnowsky
1999-09-06 18:18 ` Adam Spiers
1999-09-06 18:21   ` Adam Spiers
1999-09-07  8:57     ` Peter Stephenson
1999-09-07  9:18       ` Adam Spiers
1999-09-06  9:28 Sven Wischnowsky
1999-09-06 10:07 ` Adam Spiers
1999-09-05 21:38 Adam Spiers

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=199909070832.KAA03607@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).