Created
November 13, 2021 06:15
-
-
Save Cologler/ee4a5d887951344cd9f88b48de552273 to your computer and use it in GitHub Desktop.
load all partial scripts to caller context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load all partial scripts to caller context. | |
# - for caller, add `. "$(Split-Path $PSCommandPath)\Load-PartialScripts.ps1"`; | |
# - the partial scripts must named `{caller}.{partial}.ps1`; | |
foreach ( | |
$item in $( | |
Get-ChildItem ` | |
-Path $(Split-Path $MyInvocation.PSCommandPath -Parent -Resolve) ` | |
-Filter "$(Split-Path $MyInvocation.PSCommandPath -LeafBase).*$(Split-Path $MyInvocation.PSCommandPath -Extension)" ` | |
| Sort-Object { Split-Path $_ -LeafBase } | |
) | |
) { | |
. $item.FullName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment