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

Re: (prefix case terminators?) Re: alias with a parameter



On Thu, Apr 15, 2021 at 12:56 PM Marc Chantreux <eiro@xxxxxxxxx> wrote:
>
> > However you really don't need that test at all:
> > case "$1" in
> >   ("") false;;
> >   ([A-Z]|V<->|G*);;
> >   (*) echo "Yes expand";;
> > esac
>
> i would have written ${1-} so -u can be used.

I'm not following that at all:  -u where?

> also: i really think that using terminators as "continuation"
> ease the code reading

Entirely my opinion, but I find your example much MORE difficult to read.

> * it makes code more aligned

Only if you start with the (jarring to me) "in" on a new line.

> * it's easier to spot a different terminator than ;;

For that, I'd put the terminator on a line by itself, which I would
also do if the case branch was more than one line or if the case
pattern was quite long, but with short patterns and the terminators
all ;; it seems unnecessary.




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