zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: PATCH: expanding parameters like echo/print builtins
Date: Wed, 11 May 2011 18:22:03 +0200	[thread overview]
Message-ID: <BANLkTinovAiSEF4rr9xEi=0J24oq+mTbEg@mail.gmail.com> (raw)
In-Reply-To: <110511090302.ZM23917@torch.brasslantern.com>

On 11 May 2011 18:03, Bart Schaefer <schaefer@brasslantern.com> 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 <schaefer@brasslantern.com> 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


  reply	other threads:[~2011-05-11 16:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11 13:02 Mikael Magnusson
2011-05-11 15:03 ` Bart Schaefer
2011-05-11 15:14   ` Mikael Magnusson
2011-05-11 16:03     ` Bart Schaefer
2011-05-11 16:22       ` Mikael Magnusson [this message]
2011-05-11 16:48         ` Bart Schaefer
2011-05-11 17:11           ` Mikael Magnusson
2011-05-11 15:47   ` Oliver Kiddle
2011-05-11 16:21 ` Peter Stephenson
2011-05-11 16:38   ` Mikael Magnusson
2011-05-11 17:07     ` Peter Stephenson
2011-05-11 17:19       ` Mikael Magnusson
2011-05-11 17:26         ` Peter Stephenson
2011-05-11 17:35           ` Mikael Magnusson
2011-05-11 17:43           ` Mikael Magnusson
2011-05-12 10:10             ` Bart Schaefer
2011-05-12 10:40               ` Mikael Magnusson
2011-05-12 14:04                 ` Bart Schaefer
2011-05-12 15:49                   ` PATCH: Add g:: parameter expansion flag Mikael Magnusson
2011-05-12 19:41                     ` Mikael Magnusson
2011-05-13  8:54                       ` Peter Stephenson
2011-05-13  9:51                         ` Mikael Magnusson
2011-05-13 11:54                           ` Peter Stephenson
2011-05-13 12:38                             ` Mikael Magnusson
2011-05-14 11:41 PATCH: expanding parameters like echo/print builtins Jilles Tjoelker
2011-05-14 18:41 ` Bart Schaefer

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='BANLkTinovAiSEF4rr9xEi=0J24oq+mTbEg@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --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).