New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syntax: joins lines if escaped newlines aren't preceded by a space #953
Comments
mvdan
changed the title
Joining of lines with options/arguments is inconsistent
syntax: joining of lines with options/arguments is inconsistent
Apr 16, 2023
This appears to happen because you are using
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: