Go to file
Lockszmith bfb2e38cc0 MyAliases management
 Get-MyAliases, Reload-MyAliases
📝🕸 https:/blog.lksz.me/a-case-of-sensitivity/
2020-09-16 14:40:30 -04:00
Get-MyAliases.ps1 MyAliases management 2020-09-16 14:40:30 -04:00
LICENSE Initial commit 2020-09-16 10:56:03 -04:00
README.md MyAliases management 2020-09-16 14:40:30 -04:00
Reload-MyAliases.ps1 MyAliases management 2020-09-16 14:40:30 -04:00

README.md

PowerShell Scripts

These are the scripts that go into $MyPSScriptRoot which is part of my $env:PATH.

The development of these is documented in my blog: https://blog.lksz.me

They are provided 'as is' for your review and for your reuse.

There is a blog post about how to clone this repo and use it as your own.

The scripts all assume the following code is part of one of your $PROFILE files:

$global:PathEnvDelimiter = $(if( $PSVersionTable.Platform -match 'unix' ) {':'} else {';'})
function Split-PathEnv {
param([string]$EnvPath)
  $EnvPath -split $PathEnvDelimiter
}

$global:MyPSModulePath = Split-PathEnv $env:PSModulePath | Where-Object { $_ -match "^$(Resolve-Path ~)" }

if( -not $MyPSModulePath ) {
  $MyPSModulePath = Resolve-Path ~/powershell/Modules
  if( -not (Test-Path $MyPSModulePath) ) {
      New-Item -ItemType Directory -Path $MyPSModulePath -Force | Out-Null
  }
  $env:PSModulePath = "$MyPSModulePath$PathEnvDelimiter$env:PSModulePath"
}

$local:p = Split-PathEnv $env:PATH
$global:MyPSScrtipRoot = Join-Path (Split-Path -Parent $MyPSModulePath) Scripts
if( -not (Test-Path $MyPSScrtipRoot) ) {
  New-Item -ItemType Directory -Path $MyPSScrtipRoot -Force | Out-Null
}

$p = @($p[0], $MyPSScrtipRoot) + $($p | Select-Object -Skip 1)
$env:PATH = $p -join $PathEnvDelimiter