Streamlined pwsz loading from Linux shells

Get-Path updated to support @ notation.
MyConfig class updated to resolve Paths before testing.
MyScript class will look recursivley - this might need to change again.
config.files.json updated to support shell-loading-snippets
shell-loading-snippets added, with single line of code to inject into
startup shell scripts (.zshrc, .bashrc, .shrc)
This commit is contained in:
Gal Szkolnik 2020-12-01 23:31:42 -05:00
parent e34d9d4e4d
commit c6cc116564
7 changed files with 73 additions and 3 deletions

View file

@ -39,9 +39,10 @@ class MyConfig { #: System.Management.Automation.IValidateSetValuesGenerator {
$local:exists = $false;
$local:first = $null
foreach( $local:configPath in $flatConfigList ) {
$configPath = Get-Path $configPath
if( -not $first ) { $first = $configPath }
if( $Force -or (Test-Path $configPath) ) {
$result += Get-Path $configPath
$result += $configPath
$exists = $true
}
}

View file

@ -2,7 +2,7 @@ class MyScript { #: System.Management.Automation.IValidateSetValuesGenerator {
static [string[]] _GetValidValues([string]$wordToComplete,[bool]$CurrentOnly,[bool]$Strict) {
$local:possibleValues = $(
Get-MyPackages -ReturnFullPath -IncludeRoot -Force:$(-not $CurrentOnly) |
Get-ChildItem -Filter '*.ps1' |
Get-ChildItem -Recurse -Filter '*.ps1' |
Select-Object -ExpandProperty FullName | ForEach-Object {
$_ -replace '\.ps1$','' -replace "$($MyPSScriptRoot -replace '\\',"\\")[/\\]",''
}