Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: expanding parameters like echo/print builtins



On 11 May 2011 18:48, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 11,  6:22pm, Mikael Magnusson wrote:
> } Subject: Re: PATCH: expanding parameters like echo/print builtins
> }
> } 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.
>
> I don't think that's a problem, but yes it should be doc'd.
>
> BTW, the construct "... the exception of the next sentence.  In none
> of these modes ..." is a little clunky; probably OK to just say "...
> except that in none of these modes ..."

How's this?

item(tt(g:opts:))(
Expand words like the echo builtin when no options are given (tt(g::)).
With the tt(o) option, octal escapes don't take a leading zero.  With the
tt(c) option, sequences like `tt(^X)' are interpreted.  With the tt(e)
option, interprets `tt(\M-t)' and similar sequences like the print
builtin.  With both of the tt(o) and tt(e) options, behaves like the
print builtin except that in none of these modes is `tt(\c)' interpreted.
)

And this for s,

 separator var(string).  Note that a var(string) of two or more
 characters means that all of them must match in sequence; this differs from
 the treatment of two or more characters in the tt(IFS) parameter.
-See also the tt(=) flag and the tt(SH_WORD_SPLIT) option.
+See also the tt(=) flag and the tt(SH_WORD_SPLIT) option.  An empty
+string may also be given in which case every character will be a separate
+element.


> } 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).
>
> I don't like the idea of limiting the delimiter to ":".

Okay, I guess I don't really either.

> RE Oliver's suggestion of a (\) flag -- I considered that too but it
> is not clear whether the backslash might be removed in some contexts
> before zsh gets around to parsing the flags.
>
> I suppose we could use (/) (to mean "reverse the backslashes"?) but ...

${(/::) looks like an alien girl waving goodbye. :)

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author