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

Re: optimal expansions?



On Sun, Apr 21, 2024 at 6:14 PM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
>
> 2024-04-21 16:19:24 +0200, Roman Perepelitsa:
> > On Sun, Apr 21, 2024 at 4:10 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> > >
> > > On 2024-04-21 05:23, Roman Perepelitsa wrote:
> > >
> > > Seems we want '-r' most of the time.  And the '--' should always be there.
> > >
> > > The missing `-r` is a bug. It should be there. The `--` in this case
> > > is optional because the positional argument cannot start with a dash.
> > >
> > > But the '--' is good standard practice, yes?
> >
> > You can call it that. It's one of those standard practices that I
> > don't follow, but if you find the trade-off palatable, go for it.
> [...]
>
> I would urge you to reconsider, especially for the "print"
> built-in of zsh.

I'm curious. Which of these would you use?

    print rebooting
    print -r -- rebooting

Or these:

    ls ~
    ls -- ~

I prefer the first form in both of these examples, whether in scripts
or interactively. It's less code, so less time to read and understand.

Roman.




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