如果你只是想使你的構建腳本讀取,你可以在正常的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