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

Re: Can this snippet be further improved?



On Fri, Jul 28, 2023 at 3:07 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> For example, would be :P instead of :A better?
>
> On Fri, 28 Jul 2023 at 09:53, Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> >     0=${${ZERO:-${(%):-%x}}:A}

What is $ZERO ?  (I'm not very familiar with the "zsh plugin standard" here.)

Is there a reason not to use ${funcstack[1]} instead of ${(%):-%x} ?
I presume you're assigning 0= at top level of the plugin, otherwise %x
is going to be the file where the function is defined rather than the
file where the function is being executed and further you'd mess up
FUNCTIONARGZERO et al.  I suppose %x doesn't require zsh/parameter, is
that really an issue?

As to :A vs. :P, it almost seems like :a:P would be preferable to
either of those ... :A is described as ":a followed by realpath()
except where there is no realpath(3)" whereas :P is "LIKE realpath()"
but doesn't actually require realpath(3).




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