From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 9412 invoked from network); 28 Apr 2020 17:55:17 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 28 Apr 2020 17:55:17 -0000 Received: (qmail 25957 invoked by alias); 28 Apr 2020 17:55:03 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45735 Received: (qmail 9060 invoked by uid 1010); 28 Apr 2020 17:55:03 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25793. spamassassin: 3.4.4. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 5.791062 secs); 28 Apr 2020 17:55:03 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedriedugdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkjghfofggtgfgsehtqh dttdertdejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukedtrddufedtrddugeejne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshes uggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Tue, 28 Apr 2020 17:54:15 +0000 From: Daniel Shahaf To: oxiedi@yandex.ru Cc: zsh-workers@zsh.org Subject: Re: [PATCH 2/2] _arguments: Add the -0 flag, which makes $opt_args be populated sanely. Message-ID: <20200428175415.60ebae64@tarpaulin.shahaf.local2> In-Reply-To: <1314911588066668@iva8-5e86d95f65ab.qloud-c.yandex.net> References: <20200427193040.7484-1-danielsh@tarpaulin.shahaf.local2> <20200427193040.7484-2-danielsh@tarpaulin.shahaf.local2> <1314911588066668@iva8-5e86d95f65ab.qloud-c.yandex.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable oxiedi@yandex.ru wrote on Tue, 28 Apr 2020 14:37 +0500: > > With this, =C2=ABlocal -a values=3D( ${(0)opt_args[--foo]} )=C2=BB woul= d get the > > value or values of the --foo option, as typed on the command line. > > 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. =20 >=20 > I've used >=20 > local -a values > IFS=3D: read -A values <<<$opt_args[--foo] >=20 > once. Does it have some drawbacks? Good idea, thanks. It would DTWT when there's a literal newline in ${opt_args[--foo]}. Also, it requires an additional temporary variable before accessing ${opt_args[--foo]} whenever the value of --foo may contain colons, even if the --foo option is not repeatable. On the other hand, the NUL separators approach would DTWT when there is a literal NUL in the arguments. That could in theory happen when completing the arguments to a builtin. If someone runs into _that_, they should implement and use dana's ${(s.:..\.)} [grep for =C2=ABspsep=C2= =BB], or invent another way for _arguments to communicate the values to its caller. Thanks again, Daniel