Skip to content

Instantly share code, notes, and snippets.

@ritalin
Created September 10, 2014 16:53
Show Gist options
  • Save ritalin/c9b9cfe58222c1756735 to your computer and use it in GitHub Desktop.
Save ritalin/c9b9cfe58222c1756735 to your computer and use it in GitHub Desktop.
function test(){
get-pscallstack | select -skip 1 -first 1 | %{
if ([io.path]::GetExtension($_.ScriptName) -eq ".psm1") {
if (test-path "$($_.ScriptName).config") {
[xml](Get-Content "$($_.ScriptName).config")
}
elseif (test-path "$($_.ScriptName).json") {
[string]::join('', (Get-Content "$($_.ScriptName).json")) | ConvertFrom-Json
}
else {
@{}
}
}
else {
@{}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment