mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2025-01-26 00:28:34 +00:00
Upgrade tests to Nushell 0.33
This commit is contained in:
parent
340454b49b
commit
b9b0abe471
@ -1,6 +1,6 @@
|
|||||||
let
|
let
|
||||||
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz") {};
|
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz") {};
|
||||||
pkgs-master = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/ebe28430ba2d6d0e5562bf69c4afe907645fac61.tar.gz") {};
|
pkgs-master = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/8e4c6b845965440850eaec79db7086e5d9e350fd.tar.gz") {};
|
||||||
pkgs-python = pkgs-master.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]);
|
pkgs-python = pkgs-master.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]);
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
# Default prompt for Nushell.
|
# Default prompt for Nushell.
|
||||||
def __zoxide_prompt [] {
|
def __zoxide_prompt [] {
|
||||||
let git = $"(do -i {git rev-parse --abbrev-ref HEAD} | str trim)"
|
let git = $'(do -i {git rev-parse --abbrev-ref HEAD} | str trim)'
|
||||||
let git = (if (echo $git | str length) == 0 {
|
let git = (if (echo $git | str length) == 0 {
|
||||||
""
|
''
|
||||||
} {
|
} {
|
||||||
build-string (char lparen) (ansi cb) $git (ansi reset) (char rparen)
|
build-string (char lparen) (ansi cb) $git (ansi reset) (char rparen)
|
||||||
})
|
})
|
||||||
build-string (ansi gb) (pwd) (ansi reset) $git "> "
|
build-string (ansi gb) (pwd) (ansi reset) $git '> '
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ section }}
|
{{ section }}
|
||||||
@ -32,7 +32,7 @@ def __zoxide_hook [] {
|
|||||||
|
|
||||||
{%- when InitHook::Pwd %}
|
{%- when InitHook::Pwd %}
|
||||||
def __zoxide_hook [] {}
|
def __zoxide_hook [] {}
|
||||||
$"zoxide: PWD hooks are not supported on Nushell.(char nl)Use 'zoxide init nushell --hook prompt' instead.(char nl)"
|
$'zoxide: PWD hooks are not supported on Nushell.(char nl)Use (char sq)zoxide init nushell --hook prompt(char sq) instead.(char nl)'
|
||||||
{%- endmatch %}
|
{%- endmatch %}
|
||||||
|
|
||||||
{{ section }}
|
{{ section }}
|
||||||
@ -44,7 +44,7 @@ $"zoxide: PWD hooks are not supported on Nushell.(char nl)Use 'zoxide init nushe
|
|||||||
def __zoxide_z [...rest:string] {
|
def __zoxide_z [...rest:string] {
|
||||||
if (shells | where active == $true | get name) != filesystem {
|
if (shells | where active == $true | get name) != filesystem {
|
||||||
if (echo $rest | length) > 1 {
|
if (echo $rest | length) > 1 {
|
||||||
$"zoxide: can only jump directories on filesystem(char nl)"
|
$'zoxide: can only jump directories on filesystem(char nl)'
|
||||||
} {
|
} {
|
||||||
cd (echo $rest)
|
cd (echo $rest)
|
||||||
{%- if echo %}
|
{%- if echo %}
|
||||||
@ -56,7 +56,7 @@ def __zoxide_z [...rest:string] {
|
|||||||
if (echo $rest | length) <= 1 && ($arg0 == '-' || (echo $arg0 | path expand | path exists)) {
|
if (echo $rest | length) <= 1 && ($arg0 == '-' || (echo $arg0 | path expand | path exists)) {
|
||||||
cd $arg0
|
cd $arg0
|
||||||
} {
|
} {
|
||||||
cd $"(zoxide query --exclude (pwd) -- $rest | str trim)"
|
cd $'(zoxide query --exclude (pwd) -- $rest | str trim)'
|
||||||
}
|
}
|
||||||
{%- if echo %}
|
{%- if echo %}
|
||||||
pwd
|
pwd
|
||||||
@ -67,9 +67,9 @@ def __zoxide_z [...rest:string] {
|
|||||||
# Jump to a directory using interactive search.
|
# Jump to a directory using interactive search.
|
||||||
def __zoxide_zi [...rest:string] {
|
def __zoxide_zi [...rest:string] {
|
||||||
if (shells | where active == $true | get name) != filesystem {
|
if (shells | where active == $true | get name) != filesystem {
|
||||||
$"zoxide: can only jump directories on filesystem(char nl)"
|
$'zoxide: can only jump directories on filesystem(char nl)'
|
||||||
} {
|
} {
|
||||||
cd $"(zoxide query -i -- $rest | str trim)"
|
cd $'(zoxide query -i -- $rest | str trim)'
|
||||||
{%- if echo %}
|
{%- if echo %}
|
||||||
pwd
|
pwd
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
@ -99,7 +99,7 @@ alias {{cmd}}i = __zoxide_zi
|
|||||||
#
|
#
|
||||||
# Add this to your configuration (usually ~/.config/nu/config.toml):
|
# Add this to your configuration (usually ~/.config/nu/config.toml):
|
||||||
#
|
#
|
||||||
# prompt = "__zoxide_hook;__zoxide_prompt"
|
# prompt = '__zoxide_hook;__zoxide_prompt'
|
||||||
# startup = ["zoxide init nushell --hook prompt | save ~/.zoxide.nu", "source ~/.zoxide.nu"]
|
# startup = ['zoxide init nushell --hook prompt | save ~/.zoxide.nu', 'source ~/.zoxide.nu']
|
||||||
#
|
#
|
||||||
# You can replace __zoxide_prompt with a custom prompt.
|
# You can replace __zoxide_prompt with a custom prompt.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user