hello,

On Mon, Mar 17, 2025 at 09:31:22PM +0100, Thorsten Glaser wrote:
> > Scripts should follow the style produced by shfmt(1)
> FWIW, never heard of that tool.

shell is one of my main programming langages since the last millenium
and I confirm: shfmt is unkown by the communities I belong to.

> Don’t indent case, it’s useless and just adds clutter.

*yes* thanks for that

Also I would like to go one step further: as in some shells, the case
separator can be ;; or ;&, "hiding" it in the cod indentation is
something I wanted to avoid.

my coding style for many years is:

* case separators prefixes the line
* use the opening parenthesis

my vim snippet for this is

case "${1}"
in (-h | --help | help ) "exactly! HELP!!!!! we need a scrum master here!"
;; (……)
;; (*) "that's no moon, it's a space station … -- Obiwan. Aldeeran"
esac

a real life exemple can be seen here:

https://git.unistra.fr/mc/dot/-/blob/main/bin/tsveverything?ref_type=heads#L44


-- 
Marc Chantreux

Reply via email to