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.35k stars 346 forks source link

man page: incorrect statement regarding use of `-` (read from stdin) and `--filename` flag #1079

Closed ktetzlaff closed 1 month ago

ktetzlaff commented 6 months ago

A little nitpick ...

The shfmt man page states

If any EditorConfig files are found, they will be used to apply formatting options. If any parser or printer flags are given to the tool, no EditorConfig formatting options will be used. A default like -i=0 can be used for this purpose.

Here's the problem: The --filename flag, which is intended to help with finding EditorConfig files when reading from stdin is listed under Parser flags and thus (according to the statement above) should stop EditorConfig formatting options from being used.

Possible solutions:

  1. Move the --filename flag to either the Generic or Utility flags section, or
  2. add an explicit exception for the --filename flag to the statement quoted above.
mvdan commented 1 month ago

Good point, and thank you for bringing it up. I agree with your first suggestion; even though the filename affects the parser, it also affects other parts of the tool such as the EditorConfig logic, so it can go under generic flags.