-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Fix 2854, accidental treatment of old flags as folders #3024
Conversation
src/Fantomas/Program.fs
Outdated
results.TryGetResult <@ Arguments.Input @> | ||
|> Option.map (fun input -> | ||
input | ||
|> List.filter (fun s -> not (s.StartsWith("--", StringComparison.Ordinal)))) // don't accidentally treat old flags as folders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there not any Argu configuration we are missing here? Don't parse invalid input or something?
Hello, For me, the problem reported in #2854 is not limited to flags. For example, if I run Then fantomas creates these folders.
This behaviour feels strange to me, this means if the user makes a typo then the command has a different behaviour than what he would expect. If this is for legacy reason, that's unfortunate. Otherwise, I think it would be nice to treat input folders as input only. For example, if I run |
I pushed a change that should handle old flags and non-existing folders as @MangelMaxime described. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@MangelMaxime Please test our latest alpha |
I confirm that the alpha doesn't create the folder if it doesn't exist: ➜ Glutinum.Converter git:(main) ✗ dotnet fantomas di1 dir2
Input path 'di1' not found.
➜ Glutinum.Converter git:(main) ✗ dotnet fantomas src dir2
Input path 'dir2' not found.
# src folder exist Thank you |
fixes #2854
It's a bit complicated, but
first we treated unknown flags as input folders
these input folders weren't found and then we treated these folders as output folders
these output folders didn't exist, so we created them, hence the famous
--recurse
folder came into life.