zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Jun T <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: How about separating "_arguments --" into a new function?
Date: Sun, 17 Oct 2021 16:49:17 +0000	[thread overview]
Message-ID: <20211017164917.GA30795@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <D2CD445E-2922-417F-AC7B-56D459BA0194@kba.biglobe.ne.jp>

Jun T wrote on Thu, Oct 14, 2021 at 19:58:17 +0900:
> 2021/10/13 1:04, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > perhaps the tool could be designed with an eye towards updating existing
> > completion functions?  For instance, perhaps the tool could inspect the
> > existing _cmd file and omit from the output any lines where the
> > --foo[lorem ipsum] part already appears in the file?
> 
> Such a tool is useful, of cause, but analyzing the existing _cmd is
> would be quite complicated, I guess.
> 

Well, the tool doesn't need to update the file by itself.  Even if it
simply spat options grouped into three categories — "definitely in the
file", "definitely not in the file", and everything else — that'd still
save most of the work in updating the file.

> >> Or just using $_args_cache_cmd is enough?
> > 
> > If it is enough, then it should be made more discoverable.
> 
> I guess it is enough since no one is requesting to separate _arguments.
> How about the following?
> 

Are we happy with documenting it as a first-class feature, i.e., one
that we would be expected to continue supporting?  Or would we rather
document this as a "we may change this in the future" thing?

Flow-wise, the mention of _gnu_generic seems to me to be oddly placed:
it's right between mentioning the variable's existence and use.
I suppose I'm suggesting to reorder the information being added.  Not
a blocker, of course; just nice to have.

Typos: "commnd", "chache".

Would prefer «print -r --» in case of backslashes, or perhaps just
«typeset -p».

Cheers,

Daniel


> diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
> index 89b918d60..c00270f3d 100644
> --- a/Doc/Zsh/compsys.yo
> +++ b/Doc/Zsh/compsys.yo
> @@ -4237,6 +4237,17 @@ as `tt(-)tt(-enable-foo)', but the script also accepts the negated form
>  
>  example(_arguments -- -s "LPAR()(#s)--enable- --disable-RPAR()")
>  
> +The list of var(spec)s derived from the help text is saved in an array
> +parameter `tt(_arg_cache_)var(cmd)' where `var(cmd)' is the name of the
> +command.  If `tt(_arguments -)tt(-)' (or tt(_gnu_generic)) does not work
> +satisfactorily for a commnd `tt(foo)', you can save the specs in a file
> +`tt(_foo)' by
> +
> +example(echo ${(qqq)_arg_chache_foo} > _foo)
> +
> +and use it as a draft of your own completion function for the command
> +`tt(foo)'.
> +
>  em(Miscellaneous notes)
>  
>  Finally, note that tt(_arguments) generally expects to be the primary
> 
> 
> 
> 


  reply	other threads:[~2021-10-17 16:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 16:12 Jun. T
2021-10-12 16:04 ` Daniel Shahaf
2021-10-14 10:58   ` Jun T
2021-10-17 16:49     ` Daniel Shahaf [this message]
2021-10-18  4:40       ` Jun T
2021-10-21 14:15         ` Daniel Shahaf
2021-10-24  9:53           ` Jun. T
2021-10-25 19:46             ` 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=20211017164917.GA30795@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --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
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).