-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
[Feature request] Support multiple files/dirs as command-line arguments #1696
Comments
Hey Paul, would a .fantomasignore file help in your scenario? |
It would help, yes. I do think that supporting multiple files/dirs on the command line is the standard way of supporting this, and certainly it's extremely confusing that when I enter multiple files on the command line and run |
I'm slowly getting on board with this but what would happen when you combine this with |
Yes, exactly. That does lead to questions like "what if I want one directory to recurse, but not another", to which the solution would be to do your own recursion with |
I'm less familiar with what Another setting that will conflict with multiple files is the |
Sure, this example in inlined from https://github.com/darklang/dark/blob/main/scripts/format.
|
That seems to be common, I would expect --out to error out (perhaps unless --out was a directory, but that seems like a level of complexity that's not helpful, at least at first) |
Thank you for that example. I feel like the boundaries of this feature are getting clearer.
For the next major, I would remove the Would you be interested in submitting a PR for this? |
Thanks for the analysis. I probably don't have time to contribute this back right now, but might in the future. |
Hey @pbiggar, I've published the first alpha with this feature: |
I switched over to this method, thanks a million! |
I propose we allow multiple files and directories to be listed on the command line, and for all those files/dirs to be formatted, checked, recursed, etc.
The existing way of Fantomas deals with this problem is probably the
--recurse
flag.Pros and Cons
The struggle that I have here is that when I want to check that my project is formatted, the
--recurse
flag doesn't work for me. This is because I have many .fsx files in my .paket directory, and also I have OCaml files with the .ml/.mli suffix in the same project.I have a script that looks through my repo and finds potential files to be formatted. Those files are put as command line arguments to the formatting tool, which works well with prettier, rustfmt, and ocamlformat.
The other way to handle this now is to call fantomas individually for each file. This works but is very very slow compared the other approach.
One alternative way to handle this would be to add a
--ignore
flag. This seems to be objectively worse as then we're going down the path of creating a directory traversal language, while there exist better tools for that such asfind
.Examples
dotnet fantomas --check dir1 dir2 file1.fs file2.fs
This would operate the same as
--recurse
except it would not choose the files via recursion, just take the ones listed in thePlease provide multiple examples (before and after scenarios) and explain what rules did apply to achieve the outcome.
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: