zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-workers@zsh.org
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	[thread overview]
Message-ID: <669167A9-2B46-446C-A488-FD766A6CFD6D@dana.is> (raw)
In-Reply-To: <20200427193040.7484-2-danielsh@tarpaulin.shahaf.local2>

On 27 Apr 2020, at 14:30, Daniel Shahaf <d.s@daniel.shahaf.name> 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


  reply	other threads:[~2020-04-27 20:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 19:30 [PATCH 1/2] internal: Add a second parameter to zlinklist2array(), analogously to hlinklist2array() Daniel Shahaf
2020-04-27 19:30 ` [PATCH 2/2] _arguments: Add the -0 flag, which makes $opt_args be populated sanely Daniel Shahaf
2020-04-27 20:06   ` dana [this message]
2020-04-28  9:37   ` oxiedi
2020-04-28 17:54     ` [PATCH " 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=669167A9-2B46-446C-A488-FD766A6CFD6D@dana.is \
    --to=dana@dana.is \
    --cc=d.s@daniel.shahaf.name \
    --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).