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
This commit is contained in:
lksz 2020-09-18 15:41:58 -04:00
parent bb2488e591
commit 06052cfa29
14 changed files with 186 additions and 13 deletions

View file

@ -9,17 +9,18 @@ do {
try {
$local:newAliases += Get-Alias -Scope $_scope |
Where-Object {
($_.Definition -match "^$MyPSScrtipRoot") -or ($_.Description -match '#MyAlias')
($_.Definition -match "^$MyPSScriptRoot") -or ($_.Description -match '#MyAlias')
}
if( $newAliases ) {
$allAliases += $newAliases
$MyAliasScope = $_scope;
Write-Verbose "`$MyAliasScope is now set to $MyAliasScope"
}
$_scope += 1
} catch {
$done = $_.Exception.Message -match 'The scope .* exceeds'
Write-Verbose "catch: $($_.Exception.Message)"
$_done = $_.Exception.Message -match 'The scope .* exceeds'
}
} until ( $done )
$_scope += 1
} until ( $_done )
$allAliases