private/New-Header.ps1
function New-Header { [CmdletBinding()] param ( [Parameter(Position = 0)] [ValidateRange(1, 6)] [Int] $Heading = 1, [Parameter(Mandatory, Position = 1, ParameterSetName = "ScriptBlock")] [scriptblock] $TextBlock, [Parameter(Mandatory, Position = 1, ParameterSetName = "String")] [string] $Text ) if ($PSBoundParameters.ContainsKey('TextBlock')) { $Text = $TextBlock.Invoke() } $formatter["Heading$Heading"] -f $Text | Write-Output [System.Environment]::NewLine | Write-Output } |