You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(finalContinuation:string list * string list -> string list * string list)
105
-
=
106
-
match files with
107
-
|[]-> finalContinuation ([],[])
108
-
| h :: rest ->
109
-
loop rest (fun(files,folders)->
110
-
if isFolder h then
111
-
files,(h :: folders)
112
-
else
113
-
(h :: files), folders
114
-
|> finalContinuation)
115
-
116
-
letfilesAndFolders= loop inputs id
117
-
InputPath.Multiple filesAndFolders)
118
-
119
-
letargs=
120
-
fargo {
121
-
let!force= flag "force""f""Print the output even if it is not valid F# code. For debugging purposes only."
122
-
and! profile = flag "profile""p""Print performance profiling information."
123
-
and! out = pOut
124
-
125
-
and! check =
126
-
flag
127
-
"check"
128
-
"c"
129
-
"Don't format files, just check if they have changed. Exits with 0 if it's formatted correctly, with 1 if some files need formatting and 99 if there was an internal error"
130
-
131
-
// Applicative builders with more than 5 bindings break under AOT: https://github.com/dotnet/fsharp/issues/15488
132
-
let!(daemon,version,verbosity,input)=
133
-
fargo {
134
-
let!daemon=
135
-
flag "daemon""d""Daemon mode, launches an LSP-like server that can be used by editor tooling."
136
-
137
-
and! version = flag "version""v""Displays the version of Fantomas"
138
-
and! verbosity = pVerbosity
139
-
and! input = pInput
140
-
return(daemon, version, verbosity, input)
141
-
}
142
-
143
-
return
87
+
Ok arg)
88
+
|> many
89
+
|> map (function
90
+
|[]-> InputPath.Unspecified
91
+
|[ input ]->
92
+
if Directory.Exists(input)then
93
+
InputPath.Folder input
94
+
elif File.Exists input && isFSharpFile input then
95
+
InputPath.File input
96
+
elif File.Exists input then
97
+
InputPath.NoFSharpFile input
98
+
else
99
+
InputPath.NotFound input
100
+
| inputs ->
101
+
letmissing=
102
+
inputs |> List.tryFind (fun x ->not(Directory.Exists(x)|| File.Exists(x)))
(finalContinuation:string list * string list -> string list * string list)
113
+
=
114
+
match files with
115
+
|[]-> finalContinuation ([],[])
116
+
| h :: rest ->
117
+
loop rest (fun(files,folders)->
118
+
if isFolder h then
119
+
files,(h :: folders)
120
+
else
121
+
(h :: files), folders
122
+
|> finalContinuation)
123
+
124
+
letfilesAndFolders= loop inputs id
125
+
InputPath.Multiple filesAndFolders)
126
+
127
+
// Applicative builders with more than 5 bindings break under AOT: https://github.com/dotnet/fsharp/issues/15488
128
+
let(<~|)a b = Fargo.map2 (<|) a b
129
+
130
+
letargs=
131
+
ret (fun force profile out check daemon version verbosity input ->
144
132
{ Force = force
145
133
Profile = profile
146
134
Out = out
147
135
Check = check
148
136
Daemon = daemon
149
137
Version = version
150
138
Verbosity = verbosity
151
-
Input = input }
152
-
}
139
+
Input = input })
140
+
<~| flag "force""f""Print the output even if it is not valid F# code. For debugging purposes only."
141
+
<~| flag "profile""p""Print performance profiling information."
142
+
<~| pOut
143
+
<~| flag
144
+
"check"
145
+
"c"
146
+
"Don't format files, just check if they have changed. Exits with 0 if it's formatted correctly, with 1 if some files need formatting and 99 if there was an internal error"
147
+
<~| flag "daemon""d""Daemon mode, launches an LSP-like server that can be used by editor tooling."
148
+
<~| flag "version""v""Displays the version of Fantomas"
149
+
<~| pVerbosity
150
+
<~| pInput
153
151
154
152
typeTablewith
155
153
@@ -299,7 +297,17 @@ let runCheckCommand (inputPath: InputPath) : int =
299
297
300
298
[<EntryPoint>]
301
299
letmain argv =
302
-
run "fantomas" args argv (fun _ctok args ->
300
+
if Array.contains "--help" argv then
301
+
// As of 2024-07-08, Fargo does not support any application-level help text or docs for positional arguments. Hardcode it here.
302
+
printfn
303
+
"""Learn more about Fantomas: https://fsprojects.github.io/fantomas/docs
0 commit comments