From 11ca4b836250556be22fc2d7831ef7ff699aefe8 Mon Sep 17 00:00:00 2001 From: Tage Johansson Date: Thu, 11 Jan 2024 09:14:31 +0100 Subject: [PATCH] Update Nushell template to work with Nushell 0.89. --- contrib/completions/zoxide.bash | 6 +++++- contrib/completions/zoxide.fish | 4 ++-- templates/nushell.txt | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contrib/completions/zoxide.bash b/contrib/completions/zoxide.bash index 93c19d9..38c3554 100644 --- a/contrib/completions/zoxide.bash +++ b/contrib/completions/zoxide.bash @@ -221,4 +221,8 @@ _zoxide() { esac } -complete -F _zoxide -o bashdefault -o default zoxide +if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then + complete -F _zoxide -o nosort -o bashdefault -o default zoxide +else + complete -F _zoxide -o bashdefault -o default zoxide +fi diff --git a/contrib/completions/zoxide.fish b/contrib/completions/zoxide.fish index 276cbaf..e61a1a4 100644 --- a/contrib/completions/zoxide.fish +++ b/contrib/completions/zoxide.fish @@ -22,12 +22,12 @@ complete -c zoxide -n "__fish_seen_subcommand_from edit; and __fish_seen_subcomm complete -c zoxide -n "__fish_seen_subcommand_from edit; and __fish_seen_subcommand_from increment" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_seen_subcommand_from edit; and __fish_seen_subcommand_from reload" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_seen_subcommand_from edit; and __fish_seen_subcommand_from reload" -s V -l version -d 'Print version' -complete -c zoxide -n "__fish_seen_subcommand_from import" -l from -d 'Application to import from' -r -f -a "{autojump ,z }" +complete -c zoxide -n "__fish_seen_subcommand_from import" -l from -d 'Application to import from' -r -f -a "{autojump '',z ''}" complete -c zoxide -n "__fish_seen_subcommand_from import" -l merge -d 'Merge into existing database' complete -c zoxide -n "__fish_seen_subcommand_from import" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_seen_subcommand_from import" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_seen_subcommand_from init" -l cmd -d 'Changes the prefix of the `z` and `zi` commands' -r -complete -c zoxide -n "__fish_seen_subcommand_from init" -l hook -d 'Changes how often zoxide increments a directory\'s score' -r -f -a "{none ,prompt ,pwd }" +complete -c zoxide -n "__fish_seen_subcommand_from init" -l hook -d 'Changes how often zoxide increments a directory\'s score' -r -f -a "{none '',prompt '',pwd ''}" complete -c zoxide -n "__fish_seen_subcommand_from init" -l no-cmd -d 'Prevents zoxide from defining the `z` and `zi` commands' complete -c zoxide -n "__fish_seen_subcommand_from init" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_seen_subcommand_from init" -s V -l version -d 'Print version' diff --git a/templates/nushell.txt b/templates/nushell.txt index 2cfdb00..446a09a 100644 --- a/templates/nushell.txt +++ b/templates/nushell.txt @@ -44,7 +44,7 @@ def --env __zoxide_z [...rest:string] { let path = if (($rest | length) <= 1) and ($arg0 == '-' or ($arg0 | path expand | path type) == dir) { $arg0 } else { - (zoxide query --exclude $env.PWD -- $rest | str trim -r -c "\n") + (zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n") } cd $path {%- if echo %}