-
Notifications
You must be signed in to change notification settings - Fork 4
/
WriteDocumentation.ps1
26 lines (22 loc) · 1.1 KB
/
WriteDocumentation.ps1
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
function WriteDocumentation($showDetailed) {
$currentContext = $psake.context.Peek()
if ($currentContext.tasks.default) {
$defaultTaskDependencies = $currentContext.tasks.default.DependsOn
} else {
$defaultTaskDependencies = @()
}
$docs = GetTasksFromContext $currentContext |
Where-Object {$_.Name -ne 'default'} |
ForEach-Object {
$isDefault = $null
if ($defaultTaskDependencies -contains $_.Name) {
$isDefault = $true
}
return Add-Member -InputObject $_ 'Default' $isDefault -PassThru
}
if ($showDetailed) {
$docs | Sort-Object 'Name' | format-list -property Name,Alias,Description,@{Label="Depends On";Expression={$_.DependsOn -join ', '}},Default
} else {
$docs | Sort-Object 'Name' | format-table -autoSize -wrap -property Name,Alias,@{Label="Depends On";Expression={$_.DependsOn -join ', '}},Default,Description
}
}