如果你只是想使你的构建脚本读取,你可以在正常的F#的方式添加注释:
// Tests some stuff
Target "Test" (fun _ ->
trace "Testing stuff..."
)
据我所知,在FAKE中没有任何内容可以为你的目标添加描述,但FAKE的好处在于它只是一个F#库,所以它是非常可定制的。
这里有一两件事你可以做 - 定义自己的功能,它包装Target
,但需要额外的描述,并自动生成与描述一个“帮助”的目标:
// 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
)
什么是描述的目的?它将如何使用?就像对开发者的评论一样,或者以其他方式? –
请参阅http://stackoverflow.com/questions/39929989/is-there-an-option-to-list-the-targets-maybe-with-a-description-in-fake/39967435#39967435 – fbehrens