diff --git a/cmd/shfmt/shfmt.1.scd b/cmd/shfmt/shfmt.1.scd index 84dd2dec..90d188d3 100644 --- a/cmd/shfmt/shfmt.1.scd +++ b/cmd/shfmt/shfmt.1.scd @@ -25,7 +25,7 @@ predictable. Some aspects of the format can be configured via printer flags. ## Generic flags -*-version* +*--version* Show version and exit. *-l*, *--list* @@ -70,9 +70,12 @@ predictable. Some aspects of the format can be configured via printer flags. *-p*, *--posix* Shorthand for *-ln=posix*. -*-filename* str +*--filename* str Provide a name for the standard input file. + Use of this flag is necessary for EditorConfig support to work with stdin, + since EditorConfig files are found relative to the location of a script. + ## Printer flags *-i*, *--indent* diff --git a/cmd/shfmt/testdata/script/editorconfig.txtar b/cmd/shfmt/testdata/script/editorconfig.txtar index 99037c13..34af5234 100644 --- a/cmd/shfmt/testdata/script/editorconfig.txtar +++ b/cmd/shfmt/testdata/script/editorconfig.txtar @@ -14,6 +14,10 @@ stdin stdin-filename-bash ! exec shfmt -filename=foo_posix.sh stderr '^foo_posix.sh:.* arrays are a bash' +stdin stdin-filename-bash +! exec shfmt -filename=${WORK}/foo_posix.sh +stderr ^${WORK@R}/'foo_posix.sh:.* arrays are a bash' + # Using a file path should use EditorConfig, including with the use of flags # like -l. exec shfmt input.sh