zsh-workers
 help / color / mirror / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh workers <zsh-workers@zsh.org>
Subject: Re: [PATCH 1/2] __arguments: New completion function for _arguments.
Date: Thu, 01 Apr 2021 14:53:02 +0200
Message-ID: <96182-1617281582.024669@4LIl.h-KW.lXZv> (raw)
In-Reply-To: <20210401000026.23570-1-danielsh@tarpaulin.shahaf.local2>

You wrote:
> +++ b/Completion/Zsh/Function/__arguments

It occurs to me that if completion for completion functions is a useful
thing, _compadd could define a pattern to complete compadd options for
all commands named _*.

And with your __ convention, _nothing could specify a pattern for
completion of completions for completions.

I'm not fond of _git's use of an initial __ on it's private functions
rather than just _git_... (or _git-... for subcommands). We should
perhaps decide and then document the convention.

I don't know whether you were planning to push this or if it only served
as setup for your follow-up but I'll just make a few, um, arguments:

> +  _arguments -A '-*' : \

This is a rare case where the parameter to -A needs to be more
complicated than just '-*'.

I'd actually be inclined to use _regex_arguments for this function.
Would allow specs to be broken up.

> +    '-n[set $NORMARG]' \

-n should not be used, it is fundamentally broken and will never be
fixed because the right answer to $NORMARG as it is defined can be a
list of possibilities. It grabs an internal variable from the first
element of a linked-list and dumps it out. The problem it was added to
solve would have had better solutions.

Could hide it with ! or add a comment.

> +    "-C[modify \$curcontext for \`->action' (requires \`local curcontext')]" \

This is instead of the $context array.
Should only be used where multiple valid states is not a possibility.

I fear that the note in parentheses implies just `local curcontext' and
not local curcontext="$curcontext" is needed.

> +    "-R[when \`->action' matches, return 300]" \

I don't think that really gets used much [[ -n $state ]] is more
readable.

> +    "-M[specify matchspec for completing option names and values]:matchspec for completing option names and values (default\\: 'r\\:|[_-]=* r\\:|=*')" \

The convention widely used elsewhere is to represent defaults in square
brackets without any `default: ' tag.

_description does have mostly unused features for more custom
formatting. We perhaps ought to consider whether this could be better
used for units, defaults, examples, maximums and minimums so that this
is under the control of the user.

> +    '*:spec (e.g., "*(-t --to)"{-t+,--to=}"[specify recipient]\:recipient'\''s address\:_email_addresses)'

In your example, the * needs to come after the exclusion list. ! for
ignored options comes before.

Oliver


  parent reply	other threads:[~2021-04-01 12:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  0:00 Daniel Shahaf
2021-04-01  0:00 ` [PATCH 2/2] ___arguments: New completion function for __arguments Daniel Shahaf
2021-04-01 12:53 ` Oliver Kiddle [this message]
2021-04-01 17:33   ` [PATCH 1/2] __arguments: New completion function for _arguments Daniel Shahaf
2021-04-01 22:34     ` _arguments -n / $NORMARG (was: Re: [PATCH 1/2] __arguments: New completion function for _arguments.) Daniel Shahaf
2021-04-09 19:24       ` Oliver Kiddle
2021-04-09 22:52         ` Daniel Shahaf
2021-04-02 23:58     ` [PATCH 1/2] __arguments: New completion function for _arguments Oliver Kiddle
2021-04-10 20:41       ` Lawrence Velázquez
2021-04-13 11:28         ` Daniel Shahaf
2021-04-17 12:25       ` Daniel Shahaf

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=96182-1617281582.024669@4LIl.h-KW.lXZv \
    --to=opk@zsh.org \
    --cc=zsh-workers@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

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git