You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is line-oriented to simplify diffing, sorting, etc. I would expect shfmt -p to either leave the lines as-is (maybe adding or removing a space before the final \), but the result is rather unexpected and weird:
I get the addition of extra spaces, but then it also combines all of the single-letter flags and all non-option arguments into one unreadable line. But not the envs or the long-form flags.
I feel like shfmt shouldn't interfere with the placement of arguments on separate lines at all, but if it should, it should also at the very least not produce these overlong lines of mixed short options and positional arguments.
The text was updated successfully, but these errors were encountered:
mvdan
changed the title
Joining of lines with options/arguments is inconsistent
syntax: joining of lines with options/arguments is inconsistent
Apr 16, 2023
I can't say why some arguments get a newline and some don't. I'm going to guess it's due to the same bug. Either way, there is a workaround for the bug - use spaces before your escaped newlines, which is the most common formatting as well.
mvdan
changed the title
syntax: joining of lines with options/arguments is inconsistent
syntax: joins lines if escaped newlines aren't preceded by a space
Apr 16, 2023
In my scripts, I have a few commands that follow this general pattern:
This is line-oriented to simplify diffing, sorting, etc. I would expect
shfmt -p
to either leave the lines as-is (maybe adding or removing a space before the final\
), but the result is rather unexpected and weird:I get the addition of extra spaces, but then it also combines all of the single-letter flags and all non-option arguments into one unreadable line. But not the envs or the long-form flags.
I feel like
shfmt
shouldn't interfere with the placement of arguments on separate lines at all, but if it should, it should also at the very least not produce these overlong lines of mixed short options and positional arguments.The text was updated successfully, but these errors were encountered: