You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- [CmdletBinding(SupportsShouldProcess)]param()
-
- $local:myAliases = [ordered]@{}
- $myAliases.sudo = 'Invoke-Sudo'
- $myAliases.vi = 'Edit-TextFile'
- $myAliases.vim = 'Edit-TextFile'
- $myAliases.nvim = 'Edit-TextFile'
- $myAliases.nvim = 'Edit-TextFile'
- $myAliases.l = 'ls.ps1'
- $myAliases.ll = 'ls.ps1'
-
- #######################################################################
-
- $local:IsVerbose = [bool]($PSBoundParameters['Verbose'])
-
- $local:MyAliasScope = 1
-
- $local:oldAliases = . Get-MyAliases
-
- $oldAliases = Get-Alias -Scope $MyAliasScope |
- Where-Object Name -in $($oldAliases.Name + $myAliases.Keys)
-
- if( $oldAliases -and $IsVerbose ) {
- Write-Verbose "Removing: $($oldAliases.Name -join ', ')"
- }
- $oldAliases | Remove-Alias -Scope $MyAliasScope
- Get-ChildItem (Join-Path $MyPSScriptRoot '*.ps1') |
- ForEach-Object {
- Set-Alias $($_.BaseName) $_.FullName -Scope $MyAliasScope
- }
-
- foreach( $local:alias in $myAliases.Keys ) {
- Set-Alias -Name $alias -Value $myAliases[$alias] -Description '#MyAlias' -Scope $MyAliasScope
- }
-
- if( $(. Get-ScopeDepth) -gt 0 ) { Write-Host -ForegroundColor Red "Try sourcing Reload-MyScripts instead of just running it" }
- Get-ChildItem $(Join-Path $MyPSScriptRoot profile.d) -Filter '*.ps1' | ForEach-Object { ". '$($_.FullName)';" } | Invoke-Expression
|