mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-22 12:55:13 +00:00
Handle UTF-8 output correctly in PowerShell
This commit is contained in:
parent
c137019b83
commit
9d9bcfcac2
@ -11,7 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- zsh: completions clashing with `zsh-autocomplete`.
|
- Zsh: completions clashing with `zsh-autocomplete`.
|
||||||
|
- Fzf: 'invalid option' on macOS.
|
||||||
|
- PowerShell: handle UTF-8 encoding correctly.
|
||||||
|
|
||||||
## [0.8.3] - 2022-09-02
|
## [0.8.3] - 2022-09-02
|
||||||
|
|
||||||
|
@ -5,6 +5,18 @@
|
|||||||
# Utility functions for zoxide.
|
# Utility functions for zoxide.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Call zoxide binary, returning the output as UTF-8.
|
||||||
|
function __zoxide_bin {
|
||||||
|
$encoding = [Console]::OutputEncoding
|
||||||
|
try {
|
||||||
|
[Console]::OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||||
|
$result = zoxide @args
|
||||||
|
return $result
|
||||||
|
} finally {
|
||||||
|
[Console]::OutputEncoding = $encoding
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# pwd based on zoxide's format.
|
# pwd based on zoxide's format.
|
||||||
function __zoxide_pwd {
|
function __zoxide_pwd {
|
||||||
$cwd = Get-Location
|
$cwd = Get-Location
|
||||||
@ -86,10 +98,10 @@ function __zoxide_z {
|
|||||||
else {
|
else {
|
||||||
$result = __zoxide_pwd
|
$result = __zoxide_pwd
|
||||||
if ($null -ne $result) {
|
if ($null -ne $result) {
|
||||||
$result = zoxide query --exclude $result -- @args
|
$result = __zoxide_bin query --exclude $result -- @args
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = zoxide query -- @args
|
$result = __zoxide_bin query -- @args
|
||||||
}
|
}
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
__zoxide_cd $result $true
|
__zoxide_cd $result $true
|
||||||
@ -99,7 +111,7 @@ function __zoxide_z {
|
|||||||
|
|
||||||
# Jump to a directory using interactive search.
|
# Jump to a directory using interactive search.
|
||||||
function __zoxide_zi {
|
function __zoxide_zi {
|
||||||
$result = zoxide query -i -- @args
|
$result = __zoxide_bin query -i -- @args
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
__zoxide_cd $result $true
|
__zoxide_cd $result $true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user