Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How about separating "_arguments --" into a new function?



Jun. T wrote on Sun, Oct 24, 2021 at 18:53:52 +0900:
> 
> > 2021/10/21 23:15, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> 
> > The content
> > of ${_args_cache_foo} need to be escaped once for their transit through
> > lex.c when _foo will be read by compinit, and once against «echo»'s
> > treatment of backslashes.
> 
> I know.
> But if the output of 'cmd --help' already has '\', for example
>     --escape     replace $ by \$
> then 'print -r' does not work either (if the output of 'print -r' is used
> as a spec for _arguments as is).

The output of `print -r` should not be used as an _arguments spec as-is;
backslashes, colons, and square brackets need to be escaped.

> Using (qq) (instead of (qqq)) may or may not help, but then users must
> unset RC_QUOTE (before calling print/echo).
> But anyway $_args_cache_cmd is just a 'draft' of _cmd, and users
> must edit it manually (usually lots of editing are required).
> 
> I'll push the following soon, so feel free to modify/improve it.
> 

LGTM.

Thanks,

Daniel




Messages sorted by: Reverse Date, Date, Thread, Author