Open j-lakeman opened 9 months ago
Yes me too. I look forward to when shfmt adds a space for commented lines.
#!/bin/bash
foo() {
# echo 1
#echo 2
# echo 3
echo 4
}
foo
true #test
I expect shfmt to turn the echo 1
and echo 2
lines to look like echo 3
.
No matter what flags I run with shfmt, the output is something like this:
shfmt -d format-me.sh
@@ -1,7 +1,7 @@
#!/bin/bash
foo() {
-# echo 1
+ # echo 1
#echo 2
# echo 3
echo 4
shfmt heavily borrows from Go's gofmt, which has never forced a leading space in comments, and I personally think that's fine. Most people will prefer comments leading with one space, but nothing is particularly wrong about comments that don't.
For example, what about comments starting with a tab character, what should we do with them? Or what about empty comments?
Please see this:
https://chat.openai.com/share/2fa42d22-4344-485d-acab-4c9a7847ce95
I know the tool is questionable. In this case however I used it for a quick summary.
I won't make technical decisions based on what an AI thinks. My questions above remain.
That openai link is now 404.
I'd expect this
to be formatted to that
to increase readability and to be consistent to other programming languages.