Files
Chronometer/BuildTasks/GenerateMarkdown.Task.ps1
Kevin Marquette dcb3f40371 Initial commit
2018-03-25 15:39:30 -07:00

42 lines
1.3 KiB
PowerShell

task GenerateMarkdown {
$module = Import-Module -FullyQualifiedName $ManifestPath -Force -PassThru
try
{
if ($module.ExportedFunctions.Count -eq 0)
{
'No functions have been exported for this module. Skipping Markdown generation...'
return
}
if (Get-ChildItem -Path $DocsPath -Filter '*.md' -Recurse)
{
$items = Get-ChildItem -Path $DocsPath -Directory -Recurse
foreach ($item in $items)
{
"Updating Markdown help in [$($item.BaseName)]..."
$null = Update-MarkdownHelp -Path $item.FullName -AlphabeticParamsOrder
}
}
$params = @{
AlphabeticParamsOrder = $true
ErrorAction = 'SilentlyContinue'
Locale = 'en-US'
Module = $ModuleName
OutputFolder = "$DocsPath\en-US"
WithModulePage = $true
}
# ErrorAction is set to SilentlyContinue so this
# command will not overwrite an existing Markdown file.
"Creating new Markdown help for [$ModuleName]..."
$null = New-MarkdownHelp @params
}
finally
{
Remove-Module -Name $ModuleName
}
}