Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

proposal: use shfmt for shell files #557

Closed
mvdan opened this issue Sep 20, 2016 · 8 comments
Closed

proposal: use shfmt for shell files #557

mvdan opened this issue Sep 20, 2016 · 8 comments

Comments

@mvdan
Copy link

mvdan commented Sep 20, 2016

I've recently written shfmt, the equivalent of gofmt for bash/shell programs. pacaur is pretty active and has lots of contributors, so I think it would benefit from its use.

More info: https://github.com/mvdan/sh

I've tagged a release and uploaded binaries, if that makes testing or integration with CI easier: https://github.com/mvdan/sh/releases/tag/v0.1.0

I ran shfmt -l -w -i 4 . and these are the diffs. This does all the files that either have a bash/shell extension or have no extension and a valid bash/shell shebang.

By default it indents with tabs, but it can also use any number of spaces. For now, nothing else is configurable, and I hope to keep it that way. I've used four spaces since that's what you guys seem to use.

git diff - https://clbin.com/tecrT
git diff -w - https://clbin.com/1GlVp

If you have any questions or issues, I'm happy to help.

@rmarquis
Copy link
Owner

rmarquis commented Sep 20, 2016

Interesting. See also #443 and #460.

Are the <<< $var to <<<$var changes done on purpose?

@mvdan
Copy link
Author

mvdan commented Sep 20, 2016

Yes. That is for consistency with other redirects, like >foo.

@rmarquis
Copy link
Owner

Is there a "standard" about that triple redirect formatting? I'm asking because this particular change breaks color syntax in my editor (sublime text). Color seems however fine in vim.

@mvdan
Copy link
Author

mvdan commented Sep 21, 2016

Not really. <<< is a reserved token like any other redirect operator, so it should work either way. Sounds more like sublime's shell parser/highlighter has a bug.

@rmarquis
Copy link
Owner

Well, bug or not, that is a bummer for me :/

@mvdan
Copy link
Author

mvdan commented Sep 21, 2016

Have you filed an issue about this? I would file one, but I've never used Sublime - you're probably the better person to do that.

https://github.com/sublimehq/Packages is probably the place from a quick look around.

@rmarquis
Copy link
Owner

I didn't. You are the better person to file a bug, since this impact your software. I might include some of the other modifications, but until then this is kinda useless to me.

@mvdan
Copy link
Author

mvdan commented Sep 21, 2016

I've opened an issue for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants