zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-users@zsh.org
Subject: Re: Completion error message
Date: Thu, 25 Jan 2018 21:24:32 +0100	[thread overview]
Message-ID: <9267.1516911872@thecus.kiddle.eu> (raw)
In-Reply-To: <20180125155058.ukg4xupxl37e7srk@tarpaulin.shahaf.local2>

Daniel Shahaf wrote:
> «rsync -4 -6 --<TAB>» does nothing and prints nothing.
>
> I get why it _does_ nothing — -4 and -6 are mutually exclusive, so the
> command line is invalid and it makes no sense to continue — but
> shouldn't it print an error message?

Note that _rsync uses _arguments sets. Without sets, it will complete
further options. With sets, it is aggressive about disabling 
sets such that it can narrow things to the intended set. Unfortunately,
that can easily result in all sets being deactivated.

The inactive option (-6) is seen as an invalid argument when parsing for
each of the two sets. Both sets get disabled and there's no completion.
As I mentioned in 40129, we could do something with marking sets for
fallback and examine them twice.

This also affects things without sets, try this:
  _arguments '(-6)-4' '(-4)-6' -a -b '1:arg1:(1)' '2:arg2:(2)'

The -6 option gets taken as the first positional argument and '2' gets
completed. What do you think it should complete there?
Most commands don't like position arguments to look like options.

I'm not especially keen on producing error messages from completion.

Oliver


  reply	other threads:[~2018-01-25 20:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 15:50 Daniel Shahaf
2018-01-25 20:24 ` Oliver Kiddle [this message]
2018-01-26  7:21   ` Mikael Magnusson
2018-01-28  2:16     ` Bart Schaefer
2018-01-28 21:16       ` Oliver Kiddle
2018-01-25 20:35 ` Bart Schaefer

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=9267.1516911872@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-users@zsh.org \
    /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).