=Fix profile listing mechanism
This commit is contained in:
parent
685077b250
commit
cdabbc7858
3 changed files with 24 additions and 15 deletions
|
@ -2,12 +2,14 @@
|
|||
[switch]$AsDictionary
|
||||
)
|
||||
|
||||
filter ConvertTo-Hash { param([string]$Property="Name") begin { $hash = @{} } process{ $hash[$_."$Property"] = $_ } end {return $hash} }
|
||||
filter ConvertTo-Hash { param([string]$Property='Name') begin { $hash = @{} } process{ $hash[$_."$Property"] = $_ } end {return $hash} }
|
||||
|
||||
$local:rVal = $PROFILE | fl * -Force | Out-String -Stream | Where-Object { $_ -match '( : /)|(:\\)' } |
|
||||
Select-Object @{
|
||||
N="Profile";E={($_ -split ": ")[0].Trim()}
|
||||
},@{N="Path";E={($_ -split ": ")[-1].Trim()}
|
||||
} | Select-Object *,@{N="Exists";E={Test-Path $_.Path}}
|
||||
$local:rVal = $PROFILE | Get-Member -Type NoteProperty |
|
||||
Select-Object -ExpandProperty Name |
|
||||
Select-Object @{
|
||||
N='Profile';E={$_}
|
||||
},@{N='Path';E={$PROFILE."$_"}
|
||||
} |
|
||||
Select-Object *,@{N="Exists";E={Test-Path $_.Path}}
|
||||
if( $AsDictionary ) { return $rVal | ConvertTo-Hash -Property "Profile" }
|
||||
return $rVal
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
"/zsys": "/etc/zsys.conf",
|
||||
"shrc": "~/.shrc",
|
||||
"sz-aliases-sh": "~/.sz.aliases.sh",
|
||||
"szload": [
|
||||
"@shell-loading-snippets/zsh",
|
||||
"@shell-loading-snippets/bash",
|
||||
"@shell-loading-snippets/sh"
|
||||
],
|
||||
"sz-shrc": [
|
||||
"~/.sz.shrc.sh",
|
||||
"#shrc",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue