PowerShell_Scripts/Export-FunctionSource.ps1

17 lines
409 B
PowerShell

param(
[switch]$NoHeader,
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
#[ValidateSet([Functions])]
[string[]]$FunctionName
)
$local:src = ""
foreach( $local:func in $FunctionName ) {
if( -not $NoHeader ) { $src += "`nfunction $func {" }
$src += "`n $((Get-Command -Type Function $func).Definition)"
if( -not $NoHeader ) { $src += "`n}" }
$src += "`n"
}
return $src.Trim()