Module/ArxmlAutomation-Utils.psm1
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
function Write-FunctionInfos { param ( [Parameter(ValueFromPipeline)] [string] $Content, [string] $Heading, [System.ConsoleColor] $ForegroundColor=[System.Console]::ForegroundColor ) begin{ $stack=Get-PSCallStack $commandName="" if($stack.Count -gt 1 -and $stack[1].Command){ $commandName="[$($stack[1].Command)]" } $headTab=""#" "*($stack.Count-1) if($Heading){ $headingColumn=">>>>>$commandName$Heading>>>>>" Write-Host -Object "$headTab$headingColumn" -ForegroundColor $ForegroundColor } } process{ if($Heading){ Write-Host "$headTab$Content" -ForegroundColor $ForegroundColor } else{ Write-Host "$headTab$commandName$Content" -ForegroundColor $ForegroundColor } } end{ if($Heading){ Write-Host ($headTab+($headingColumn -replace "[\S\s]","<")) -ForegroundColor $ForegroundColor } } } function Invoke-ConfigCommand{ param( [string] $FunctionToInvoke, [hashtable] $Arguments ) process{ &$Global:ArxmlAutomationConfig[$FunctionToInvoke] @Arguments } } |