-
Notifications
You must be signed in to change notification settings - Fork 5
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
Supply an "inplace" mode #35
Comments
Workaround on linux is:
|
Thanks for opening this issue! I think there are actually two related feature requests here:
Alternatively, I could see adding something like For this particular example, you can use the shell directly rather than $ sh -exc 'for f in */*.cabal; do cabal-gild -i $f -o $f; done' |
Gild could add a new I'm trying to think of how to support this without dramatically changing the command line interface. I could add a new On the other hand, I tried to make Gild easy to use in shell scripts. Formatting (or checking) multiple package descriptions is a relatively advanced workflow, so perhaps requiring a shell script isn't outrageous. |
Ormolu for example has
This would be a bigger change to the CLI.
Not outrageous, it's just an extra hurdle to overcome. Maybe it's just me, but when I write Haskell, I want to write only Haskell, and not script my way around other things. |
So why not a usage like
You might even allow lists for
|
I guess you have a good point here. I just required gild for one of my projects (turion/rhine#292) and my CI even turned out already to have a script that calls Now that I think about it even more, maybe a possibility would be to call it for a |
Yeah, I could allow both Reading the |
I see, tricky. Maybe adding a pragma comment in |
I'm still not sure if I want to support this or not. However if I do, I think it will be like this: Change the CLI to accept input as positional arguments. If there are no input files, read from STDIN. Remove the $ cabal-gild --mode=in-place */*.cabal That approach feels like the most flexible and also is similar to other source code formatters like Ormolu. It would be a breaking change of course, but it's hard to imagine a solution here that wouldn't be breaking. |
The |
Awesome, thanks! Will use it! |
For the time being, I don't think I'll change Gild's command line interface. I think formatting multiple package descriptions is a somewhat advanced situation. (Compared to, say, formatting multiple Haskell files.) As such, I think it's reasonable to handle it with a little bit of shell scripting. Or perhaps someone might be interested in writing a little wrapper script that parses a |
To modify a cabal file in place, one currently needs to supply it as
--input
and--output
. It would be easier if there was an option where one has to supply the file name only once. For example, this would allow usage like this:This is currently not directly possible, and one needs to resort to for loops or
find
.The text was updated successfully, but these errors were encountered: