=Fix profile listing mechanism

這個提交存在於:
Gilad Plex 2022-01-29 16:35:26 -05:00
父節點 685077b250
當前提交 cdabbc7858
共有 3 個檔案被更改,包括 24 行新增15 行删除

檢視檔案

@ -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",