Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 2/2] _arguments: Add the -0 flag, which makes $opt_args be populated sanely.
- X-seq: zsh-workers 45732
- From: dana <dana@xxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: [PATCH 2/2] _arguments: Add the -0 flag, which makes $opt_args be populated sanely.
- Date: Mon, 27 Apr 2020 15:06:15 -0500
- Cc: zsh-workers@xxxxxxx
- In-reply-to: <20200427193040.7484-2-danielsh@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20200427193040.7484-1-danielsh@tarpaulin.shahaf.local2> <20200427193040.7484-2-danielsh@tarpaulin.shahaf.local2>
On 27 Apr 2020, at 14:30, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Without this, the completion function would have to reverse the "escape
> colons and backslashes and join with colons" operation, and I don't know
> of an easy way to do that.
I think this is a problem in a few other parts of the completion system
(though i can't remember specifically where), and with anything that uses DSV,
like PATH-style variables. I always thought it'd be cool if (j) and (s)
supported optional (un)escaping, maybe something like this:
% arr=( 'foo' 'bar:baz' 'qux\quux' )
% print -r ${str::=${(j<:><\>)arr}} # Join by :, use \ as escape character
foo:bar\:baz:qux\\quux
% print -rl ${(s<:><\>)str} # Split by :, use \ as escape character
foo
bar:baz
qux\quux
Then you wouldn't have to do weird find/replace stuff, and it wouldn't break
if you had like an escaped back-slash in front of your delimiter
In this case `_arguments -0` would be faster/simpler and require less
'user-land' boiler-plate though. Haven't looked closely at the patch, but i'd
use it
dana
Messages sorted by:
Reverse Date,
Date,
Thread,
Author