From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26372 invoked by alias); 11 May 2011 16:22:09 -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: X-Seq: 29228 Received: (qmail 8895 invoked from network); 11 May 2011 16:22:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=B34kBudJjTa0ekPVT58DkjhOd9EGzdExGBgLP1n2ESc=; b=d4u4LGEfZbY0ENZ7d0NN9hNwB64yPreO05aaKkmPha/IoEvmNSUfmR2tCOTixypWhP eO4amKIq8H1K2yLs3U2x21kjENoNoNxTpBm548btMLU/w2jBv1lXfJgZZ5//COz135t/ /350+Ugi37v33ac9qLpQ2dnvurcZwCvg1Pu1c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=KjfiwZgHy5KLj5qG0D5sRfjRn1t8p8ndaYBJ/rWXJi2mxjw80ogHQ4jXqmE3vtd6P+ 1iElfScfzv1U30nePisDf6RJwVbJeZGn7MGX7aG7oi0XMr+KiqmffldVuwf1AIHY8D+J sNFAbbPtHV3Nr5Uf/WsHnn68vSeGMe9dJrW14= MIME-Version: 1.0 In-Reply-To: <110511090302.ZM23917@torch.brasslantern.com> References: <1305118971-25617-1-git-send-email-mikachu@gmail.com> <110511080327.ZM23776@torch.brasslantern.com> <110511090302.ZM23917@torch.brasslantern.com> Date: Wed, 11 May 2011 18:22:03 +0200 Message-ID: Subject: Re: PATCH: expanding parameters like echo/print builtins From: Mikael Magnusson To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 11 May 2011 18:03, Bart Schaefer wrote: > On May 11, 5:14pm, Mikael Magnusson wrote: > } Subject: Re: PATCH: expanding parameters like echo/print builtins > } > } On 11 May 2011 17:03, Bart Schaefer wrote: > } > > } > I'd probably have done it with ${(%)arr:gs/%/%%} > } > } Yeah, me too, except (%) doesn't expand \u304c or \0123, or any of the > } other stuff that (g) expands :). > > Hrm. What was I thinking of? Obviously hadn't eaten breakfast yet. > > } I looked at the list of letters and the first free one was b, so i > } picked that, then when i got as far as discover that the function is > } called getkeystring and noticed g was also free, i went with that. > } [...] The following characters are taken: > } #%@AacCDefFikLnoOPqQtuUvVwWXz0p~jlmrsZ_lBEMNR > > So ... > > x='#%@AacCDefFikLnoOPqQtuUvVwWXz0p~jlmrsZ_lBEMNR' > y=( {$[##a]..$[##z]} {$[##A]..$[##Z]} ) > print ${${(#)y}:#[$x]} > > b d g h x y G H I J K S T Y > > I guess (g) is as good as anything, unless someone prefers to save the > lowercase letters and go with (G). Oops, I typed l twice, the second one was supposed to be I, so the list is b d g h x y G H J K S T Y Do I need to clarify in the docs that you write g:: to give neither of the three flags? Just g by itself is an error, like for the other flags that take options. There's not really any good reason for this other than it is much easier to reuse the code used by s and j (and Z). But for s/j you want to be able to specify any character, whereas for this flag there are a limited number of options, so : could be obligatory for the field separator, then you could say just (g). Does anyone care about this? :) (It would also mean we can't use : as a new flag though). -- Mikael Magnusson