PowerShell_Scripts/Export-FunctionSource.ps1
lksz 06052cfa29 Reload-MyAliases is now Reload-MyScripts
🔖 https://blog.lksz.me/editing-with-ease/

✏️ Fixed $MyPSScriptRoot typo
 Get-ScopeDepth
🐛 Get-MyAliases didn't work correctly when sub-scoped, fixed the issue
🚚 Reload-MyAliases is now Reload-MyScripts
🐛 Reload-MyScripts loads scripts from $MyPSScriptRoot/profile.d subdir
📝 README updated to reflect change of script name and typo
2020-09-18 15:56:40 -04:00

16 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()