Is it possible to add a description to this target? Or would I have to go about it another way?
Target "Test" (fun _ ->
trace "Testing stuff..."
)
Edit:
TargetHelper allows for the description to be shown when listTargets()
is called.
At least, that's my understanding from the code here:
https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/TargetHelper.fs#L360-L365
If you just want to make your build script readable, you can add a comment in the normal F# way:
// Tests some stuff
Target "Test" (fun _ ->
trace "Testing stuff..."
)
As far as I know, there isn't anything built-in for adding descriptions to your targets in FAKE, but the nice thing about FAKE is that it is just an F# library, and so it is very customizable.
Here is one thing you could do - define your own function that wraps Target
, but takes an additional description and builds a "Help" target with the descriptions automatically:
// The 'TargetDescr' function calls 'Target', but stores the description
let Description = System.Text.StringBuilder("Usage:\n")
let TargetDescr name comment f =
Description.AppendFormat(" * {0} - {1}\n", name, comment) |> ignore
Target name f
// Now you can define targets using 'TargetDescr' and get help page for free!
TargetDescr "Test" "Tests some stuff..." (fun _ ->
trace "Testing stuff..."
)
TargetDescr "Help" "Displays this help" (fun _ ->
printfn "%O" Description
)