tasks/Generate_Wiki_Sidebar_From_Ps1.build.ps1

<#
    .SYNOPSIS
        This is a build task that creates a GitHub Wiki sidebar from PowerShell
        script files in the module's Public source folder.

    .PARAMETER ProjectPath
        The root path to the project. Defaults to $BuildRoot.

    .PARAMETER OutputDirectory
        The base directory of all output. Defaults to folder 'output' relative to
        the $BuildRoot.

    .PARAMETER BuildInfo
        The build info object from ModuleBuilder. Defaults to an empty hashtable.

    .NOTES
        This is a build task that is primarily meant to be run by Invoke-Build but
        wrapped by the Sampler project's build.ps1 (https://github.com/gaelcolas/Sampler).
#>

param
(
    [Parameter()]
    [System.String]
    $ProjectPath = (property ProjectPath $BuildRoot),

    [Parameter()]
    [System.String]
    $OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')),

    [Parameter()]
    [System.Collections.Hashtable]
    $BuildInfo = (property BuildInfo @{ })
)

# Synopsis: Generate a GitHub Wiki sidebar from PowerShell script files.
task Generate_Wiki_Sidebar_From_Ps1 {
    $error.Clear()
    Write-Host -ForegroundColor Yellow "TS: Generate_Wiki_Sidebar_From_Ps1"

    $SidebarParamsPs1 = @{
        SourcePathPs1  = Join-Path -Path $ProjectPath -ChildPath 'source/Public'
        WikiSourcePath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent'
    }

    Write-Host -ForegroundColor Yellow $SidebarParamsPs1
    New-WikiSidebarFromPs1 @SidebarParamsPs1
    Get-Error | Out-String | Write-Host -ForegroundColor Yellow
}