ormolu icon indicating copy to clipboard operation
ormolu copied to clipboard

CLI: Support specifying input folders in addition to just input files

Open matobet opened this issue 1 year ago • 3 comments

It would be nice if fourmolu could take folders as well as files as an input and would process all haskell files in that folder (recursively) so instead of

fourmolu -i $(find src -name '*.hs')

I'd be able to do just

fourmolu -i src

This is consistent what formatters in other languages support and would be a nice quality of life improvement.

matobet avatar Jul 15 '22 01:07 matobet

I dared to take a stab at this in https://github.com/tweag/ormolu/pull/911. Feedback welcome.

matobet avatar Jul 15 '22 01:07 matobet

Thanks, but this is a duplicate of #691/#697.

In general, I think it is more composable to outsource listing files to another tool (find, fd, git ls-files), rather than adding such functionality to Ormolu.

amesgen avatar Jul 15 '22 08:07 amesgen

For more advanced usages and patterns I definitely agree. But supporting the basic case as the "all *.hs files in this directory" seems to be a better UX overall and something a lot of users (including me) would expect to work out of the box. Just my $0.02.

matobet avatar Jul 16 '22 22:07 matobet

Closing as a duplicate of #691.

mrkkrp avatar Jan 05 '23 15:01 mrkkrp