Add path escapes for powershell (#313)

This commit is contained in:
Tushar 2021-12-13 12:16:12 +05:30 committed by GitHub
parent 5d81f1f22d
commit ff28b02801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PowerShell: use global scope for aliases.
- Zsh: fix errors with `set -eu`.
- Fzf: handle early selection.
- PowerShell: correctly handle escape characters in paths.
## [0.7.9] - 2021-11-02

View File

@ -7,17 +7,19 @@
# pwd based on zoxide's format.
function __zoxide_pwd {
$__zoxide_pwd = Get-Location
if ($__zoxide_pwd.Provider.Name -eq "FileSystem") {
$__zoxide_pwd.ProviderPath
$cwd = Get-Location
if ($cwd.Provider.Name -eq "FileSystem") {
$cwd.ProviderPath
}
}
# cd + custom logic based on the value of _ZO_ECHO.
function __zoxide_cd($dir) {
Set-Location $dir -ea Stop
{%- if echo %}
$(Get-Location).Path
$dir = Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
Write-Output $dir.Path
{%- else %}
Set-Location -LiteralPath $dir -ErrorAction Stop
{%- endif %}
}