@@ -11,7 +11,6 @@ open Spectre.Console
11
11
let extensions = set [| " .fs" ; " .fsx" ; " .fsi" ; " .ml" ; " .mli" |]
12
12
13
13
type Arguments =
14
- | [<Unique; AltCommandLine( " -r" ) >] Recurse
15
14
| [<Unique>] Force
16
15
| [<Unique>] Profile
17
16
| [<Unique>] Out of string
@@ -24,7 +23,6 @@ type Arguments =
24
23
interface IArgParserTemplate with
25
24
member s.Usage =
26
25
match s with
27
- | Recurse -> " Process the input folder recursively."
28
26
| Force -> " Print the output even if it is not valid F# code. For debugging purposes only."
29
27
| Out _ ->
30
28
" Give a valid path for files/folders. Files should have .fs, .fsx, .fsi, .ml or .mli extension only. Multiple files/folders are not supported."
@@ -83,13 +81,9 @@ let isInExcludedDir (fullPath: string) =
83
81
let isFSharpFile ( s : string ) =
84
82
Set.contains ( Path.GetExtension s) extensions
85
83
86
- /// Get all appropriate files, either recursively or non-recursively
87
- let allFiles isRec path =
88
- let searchOption =
89
- ( if isRec then
90
- SearchOption.AllDirectories
91
- else
92
- SearchOption.TopDirectoryOnly)
84
+ /// Get all appropriate files, recursively.
85
+ let findAllFilesRecursively path =
86
+ let searchOption = SearchOption.AllDirectories
93
87
94
88
Directory.GetFiles( path, " *.*" , searchOption)
95
89
|> Seq.filter ( fun f -> isFSharpFile f && not ( isInExcludedDir f))
@@ -182,7 +176,7 @@ let private reportCheckResults (checkResult: Format.CheckResult) =
182
176
|> List.map ( fun filename -> $" %s {filename} needs formatting" )
183
177
|> Seq.iter stdlog
184
178
185
- let runCheckCommand ( recurse : bool ) ( inputPath : InputPath ) : int =
179
+ let runCheckCommand ( inputPath : InputPath ) : int =
186
180
let check files =
187
181
Async.RunSynchronously( Format.checkCode files)
188
182
@@ -208,12 +202,12 @@ let runCheckCommand (recurse: bool) (inputPath: InputPath) : int =
208
202
logGrEqDetailed $" '%s {f}' was ignored"
209
203
0
210
204
| InputPath.File path -> path |> Seq.singleton |> check |> processCheckResult
211
- | InputPath.Folder path -> path |> allFiles recurse |> check |> processCheckResult
205
+ | InputPath.Folder path -> path |> findAllFilesRecursively |> check |> processCheckResult
212
206
| InputPath.Multiple( files, folders) ->
213
207
let allFilesToCheck =
214
208
seq {
215
209
yield ! files
216
- yield ! ( Seq.collect ( allFiles recurse ) folders)
210
+ yield ! ( Seq.collect findAllFilesRecursively folders)
217
211
}
218
212
219
213
allFilesToCheck |> check |> processCheckResult
@@ -274,8 +268,6 @@ let main argv =
274
268
275
269
let force = results.Contains <@ Arguments.Force @>
276
270
let profile = results.Contains <@ Arguments.Profile @>
277
- let recurse = results.Contains <@ Arguments.Recurse @>
278
-
279
271
let version = results.TryGetResult <@ Arguments.Version @>
280
272
281
273
let maybeVerbosity =
@@ -351,7 +343,7 @@ let main argv =
351
343
if not <| Directory.Exists( outputFolder) then
352
344
Directory.CreateDirectory( outputFolder) |> ignore
353
345
354
- allFiles recurse inputFolder
346
+ findAllFilesRecursively inputFolder
355
347
|> Seq.toList
356
348
|> List.map ( fun i ->
357
349
// s supposes to have form s1/suffix
@@ -461,7 +453,7 @@ let main argv =
461
453
daemon.WaitForClose.GetAwaiter() .GetResult()
462
454
exit 0
463
455
elif check then
464
- inputPath |> runCheckCommand recurse |> exit
456
+ inputPath |> runCheckCommand |> exit
465
457
else
466
458
try
467
459
match inputPath, outputPath with
0 commit comments