fixed the issue for powershell env variable

This commit is contained in:
rajiknows 2024-10-07 16:47:14 +05:30
parent 7113ccddea
commit 39380cdb33
1 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,12 @@ function global:__zoxide_pwd {
# cd + custom logic based on the value of _ZO_ECHO.
function global:__zoxide_cd($dir, $literal) {
if ($dir.StartsWith('%') -and $dir.EndsWith('%')) {
$envVar = $dir.Trim('%')
$dir = $env:$envVar
}
$dir = if ($literal) {
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
} else {