mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.14k stars 338 forks source link

cmd/shfmt: longer CLI flags #852

Closed p0da closed 2 years ago

p0da commented 2 years ago

Apologies if this is a duplicate, but would you consider adding a longer version of each CLI flag e.g -i -> --indent. It increases readability and is therefore a fairly common practice. Thanks!

mvdan commented 2 years ago

It's a fair request, in terms of usability. Especially for the sake of readability in scripts. Go's flag package doesn't implement full GNU flags, so I'm reluctant to pull in an external flag library just for this. But we could accept -indent as well as -i, and I think Go's flag package will also then accept --indent. Would that suffice?

Also note that we already do have the long form of each option when used in EditorConfig files; so the names would be those.

p0da commented 2 years ago

Sounds good, I believe convention has the short flag prepended with a single hyphen while the long flag is prepended with two hyphens so as long as those two formats are supported the flags should be intuitively understood.