Upgrade to Nushell v0.60.0

This commit is contained in:
Ajeet D'Souza 2022-04-08 11:15:39 +05:30
parent f541d0f255
commit 39fa1aa8df
4 changed files with 10 additions and 13 deletions

View File

@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Manpages: moved to `man/man1/*.1`. - Manpages: moved to `man/man1/*.1`.
- Nushell: upgrade minimum supported version to v0.59.0. - Nushell: upgrade minimum supported version to v0.60.0.
### Fixed ### Fixed

View File

@ -205,7 +205,7 @@ zoxide init nushell --hook prompt | save ~/.zoxide.nu
source ~/.zoxide.nu source ~/.zoxide.nu
``` ```
Note: zoxide only supports Nushell v0.59.0 and above. Note: zoxide only supports Nushell v0.60.0 and above.
</details> </details>

View File

@ -45,7 +45,7 @@ Nushell):
\fBsource ~/.zoxide.nu\fR \fBsource ~/.zoxide.nu\fR
.fi .fi
.sp .sp
Note: zoxide only supports Nushell v0.59.0 and above. Note: zoxide only supports Nushell v0.60.0 and above.
.TP .TP
.B powershell .B powershell
Add this to your configuration (find it by running \fBecho $profile\fR in Add this to your configuration (find it by running \fBecho $profile\fR in

View File

@ -14,13 +14,10 @@
# Default prompt for Nushell. # Default prompt for Nushell.
let-env __zoxide_oldprompt = (if '__zoxide_oldprompt' in (env).name { let-env __zoxide_oldprompt = (if '__zoxide_oldprompt' in (env).name {
$env.__zoxide_oldprompt $env.__zoxide_oldprompt
} else if 'PROMPT_COMMAND' in (env).name {
$env.PROMPT_COMMAND
} else { } else {
if 'PROMPT_COMMAND' in (env).name { { $env.PWD }
$env.PROMPT_COMMAND
} else {
{# An error causes Nushell to silently print the default prompt. #}
__zoxide_undefined
}
}) })
# Hook to add new entries to the database. # Hook to add new entries to the database.
@ -35,7 +32,7 @@ let-env PROMPT_COMMAND = {
} }
{%- when InitHook::Pwd %} {%- when InitHook::Pwd %}
echo $'zoxide: PWD hooks are not supported on Nushell.(char newline)Use `zoxide init nushell --hook prompt` instead.' echo "zoxide: PWD hooks are not supported on Nushell.\nUse `zoxide init nushell --hook prompt` instead."
{%- endmatch %} {%- endmatch %}
@ -51,7 +48,7 @@ def-env __zoxide_z [...rest:string] {
let path = if ($rest | length) <= 1 && ($arg0 | path expand | path type) == dir { let path = if ($rest | length) <= 1 && ($arg0 | path expand | path type) == dir {
$arg0 $arg0
} else { } else {
(zoxide query --exclude $env.PWD -- $rest | str trim -r -c (char newline)) (zoxide query --exclude $env.PWD -- $rest | str trim -r -c "\n")
} }
cd $path cd $path
{%- if echo %} {%- if echo %}
@ -61,7 +58,7 @@ def-env __zoxide_z [...rest:string] {
# Jump to a directory using interactive search. # Jump to a directory using interactive search.
def-env __zoxide_zi [...rest:string] { def-env __zoxide_zi [...rest:string] {
cd $'(zoxide query -i -- $rest | str trim -r -c (char newline))' cd $'(zoxide query -i -- $rest | str trim -r -c "\n")'
{%- if echo %} {%- if echo %}
echo $env.PWD echo $env.PWD
{%- endif %} {%- endif %}
@ -95,4 +92,4 @@ alias {{cmd}}i = __zoxide_zi
# zoxide init nushell --hook prompt | save ~/.zoxide.nu # zoxide init nushell --hook prompt | save ~/.zoxide.nu
# source ~/.zoxide.nu # source ~/.zoxide.nu
# #
# Note: zoxide only supports Nushell v0.59.0 and above. # Note: zoxide only supports Nushell v0.60.0 and above.