Version checks for cd +/-
This commit is contained in:
parent
3904026d74
commit
76af954af3
|
|
@ -30,7 +30,15 @@ function __zoxide_cd($dir, $literal) {
|
||||||
$dir = if ($literal) {
|
$dir = if ($literal) {
|
||||||
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
|
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
|
||||||
} else {
|
} else {
|
||||||
Set-Location -Path $dir -Passthru -ErrorAction Stop
|
if ($dir -eq '-' -and ($PSVersionTable.PSVersion -ge 6.1)) {
|
||||||
|
Write-Error "cd - is not supported below PowerShell 6.1. Please upgrade your version of PowerShell."
|
||||||
|
}
|
||||||
|
elseif ($dir -eq '+' -and ($PSVersionTable.PSVersion -ge 6.2)) {
|
||||||
|
Write-Error "cd + is not supported below PowerShell 6.2. Please upgrade your version of PowerShell."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Set-Location -Path $dir -Passthru -ErrorAction Stop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{%- if echo %}
|
{%- if echo %}
|
||||||
Write-Output $dir.Path
|
Write-Output $dir.Path
|
||||||
|
|
@ -74,7 +82,7 @@ if ($__zoxide_hooked -ne 1) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Error ("`n" +
|
Write-Error ("`n" +
|
||||||
"zoxide: PWD hooks are not supported below powershell 6.`n" +
|
"zoxide: PWD hooks are not supported below PowerShell 6.`n" +
|
||||||
" Use 'zoxide init powershell --hook prompt' instead.")
|
" Use 'zoxide init powershell --hook prompt' instead.")
|
||||||
}
|
}
|
||||||
{%- endmatch %}
|
{%- endmatch %}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue