Closed evan0greenup closed 5 months ago
See #691, #697, #910 for prior discussions on this topic, and #1054 for a related discussion.
Closing as a duplicate of #691. I'm not sure how exactly ormolu --mode inplace $(git ls-files '*.hs')
is too long or inconvenient. It is already a one-liner, and it can be further shortened if you create a bash alias. Personally, I made this little function in Nushell:
# Format all Haskell files in the current git repository.
def "ormolu all" [] {
ormolu -i (git ls-files '*.hs' '*.hs-boot' | lines)
}
I do see that there has been multiple requests like this, but the correct implementation here would need to
git ls-files
at least in some cases, since you seem to accept that excluding gitignored files is a desirable feature; orgit ls-files
.Otherwise there is a host of extra settings we would need to think about, such as what to do with symbolic links when we traverse a directory tree.
I prefer to avoid dealing with this complexity in an already pretty complex project.
Is your feature request related to a problem? Please describe.
For modern Haskell usage, reformatting a whole haskell project is certainly more often then single file. according to the
README.md
,ormolu --mode inplace $(find . -name '*.hs')
orormolu --mode inplace $(git ls-files '*.hs')
is too long and inconvenient for user to input.Describe the solution you'd like A
-R
or--recursive
option would works. It implies--mode inplace
and the path on the end will be the directory to make recursive reformatting.Unlike
ormolu --mode inplace $(find . -name '*.hs')
,-R
can identify scm repository. If the path is located inside Git workspace or Mercurial workspace. It can automatically ignore the files which is ignored by.gitignore
spec.Describe alternatives you've considered It would be good to referencing
black
for python https://github.com/psf/blackAdditional context The final functionality should like this