-
-
Notifications
You must be signed in to change notification settings - Fork 193
/
script.fsx
43 lines (36 loc) · 1.07 KB
/
script.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#r "paket:
nuget Fake.Core.Target
nuget Fake.DotNet.Cli
nuget FSharp.Core 5.0.2 //"
#load "./.fake/script.fsx/intellisense.fsx"
open Fake.Core
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.DotNet
let sourceFiles = !! "*.fs"
Target.create
"CheckFormat"
(fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> sprintf "%s --check"
|> DotNet.exec id "fantomas"
if result.ExitCode = 0 then
Trace.log "No files need formatting"
elif result.ExitCode = 99 then
failwith "Some files need formatting, check output for more info"
else
Trace.logf "Errors while formatting: %A" result.Errors)
Target.create
"Format"
(fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> DotNet.exec id "fantomas"
if not result.OK then
printfn "Errors while formatting all files: %A" result.Messages)
Target.runOrList ()