Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nushell breaking changes #630

Closed
fdncred opened this issue Oct 14, 2023 · 10 comments · Fixed by #632
Closed

nushell breaking changes #630

fdncred opened this issue Oct 14, 2023 · 10 comments · Fixed by #632

Comments

@fdncred
Copy link

fdncred commented Oct 14, 2023

Heads-up @ajeetdsouza, With nushell/nushell#10566 we will deprecate the def-env syntax in nushell. Our next release 0.86.0 on Oct-17 will allow both old and new syntax but the next release, 4 weeks later, will produce a warning. The new syntax is def --env.

@marcelarie
Copy link

Thanks this was really helpful!

WindSoilder added a commit to WindSoilder/zoxide that referenced this issue Nov 14, 2023
nushell will deprecate `def-env` and use `def --env` in the next release(0.87)

Currently `def --env` is already available in latest version (0.86)

Relative: ajeetdsouza#630
@lpnh
Copy link

lpnh commented Nov 15, 2023

After updating to the new nushell 0.87.0 release, I encountered the following error when opening a new terminal:

Error:   × Deprecated command
    ╭─[/home/user/.zoxide.nu:25:1]
 25 │ # Jump to a directory using only keywords.
 26 │ def-env __zoxide_z [...rest:string] {
    · ───┬───
    ·    ╰── `def-env` is deprecated and will be removed in 0.88.
 27 │   let arg0 = ($rest | append '~').0
    ╰────
  help: Use `def --env` instead


Error:   × Deprecated command
    ╭─[/home/user/.zoxide.nu:36:1]
 36 │ # Jump to a directory using interactive search.
 37 │ def-env __zoxide_zi  [...rest:string] {
    · ───┬───
    ·    ╰── `def-env` is deprecated and will be removed in 0.88.
 38 │   cd $'(zoxide query --interactive -- $rest | str trim -r -c "\n")'
    ╰────
  help: Use `def --env` instead


Error:   × Config record contains invalid values or unknown settings

Error:   × Error while applying config changes
     ╭─[/home/user/.config/nushell/config.nu:152:1]
 152 │
 153 │ ╭─▶     cd: {
 154 │ │           abbreviations: false # allows `cd s/o/f` to expand to `cd some/other/folder`
 155 │ ├─▶     }
     · ╰──── $env.config.cd is an unknown config setting
 156 │
     ╰────
  help: This value will not appear in your $env.config record.


I noticed that there are already two PRs that address this issue: #632 and #642.

@fdncred
Copy link
Author

fdncred commented Nov 15, 2023

@lpnh Just FYI - This last part has nothing to do with zoxide.

Error:   × Config record contains invalid values or unknown settings

Error:   × Error while applying config changes
     ╭─[/home/user/.config/nushell/config.nu:152:1]
 152 │
 153 │ ╭─▶     cd: {
 154 │ │           abbreviations: false # allows `cd s/o/f` to expand to `cd some/other/folder`
 155 │ ├─▶     }
     · ╰──── $env.config.cd is an unknown config setting
 156 │
     ╰────
  help: This value will not appear in your $env.config record.

$env.config.cd.abbreviations was removed from nushell in favor of using our path completions that work similarly now. You just need to comment that out of your config.nu (or remove that part).

@acidghost
Copy link

As far as I can see the only two places where zoxide needs to be updated are

def-env __zoxide_z [...rest:string] {
let arg0 = ($rest | append '~').0
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")
}
cd $path
{%- if echo %}
echo $env.PWD
{%- endif %}
}
# Jump to a directory using interactive search.
def-env __zoxide_zi [...rest:string] {
cd $'(zoxide query --interactive -- $rest | str trim -r -c "\n")'
{%- if echo %}
echo $env.PWD
{%- endif %}
}

I think it's just a matter of replacing def-env with def --env.

@Mickychen00
Copy link

Hello. I have notice there is a fix commit "f537a4e6d2f8c2eb84c63f79e290a6d1b16eeb71" in zoxide. How can I install this dev version of zoxide?

@marcelarie
Copy link

marcelarie commented Nov 21, 2023

Not sure but it might be brew install --HEAD zoxide in macOS

$: brew install --HEAD zoxide
Error: No head is defined for zoxide

@Slushee-a
Copy link

When will this be pushed to crates.io? Currently having to install from git.

@Aarkon
Copy link

Aarkon commented Dec 14, 2023

Nushell has just published their update, removing def-env altogether. As far as I understand, this breaks zoxide entirely in nu. Providing a fixed release on crates.rs anytime soon has become somewhat urgent now, I’d say.

@dtscherer
Copy link

For now I'm just using this in my env.nu

zoxide init nushell | str replace "def-env" "def --env" --all | save -f ~/.config/nushell/modules/.zoxide.nu

nagromc added a commit to nagromc/dotfiles that referenced this issue Jan 22, 2024
This commit should be reverted once ajeetdsouza/zoxide#632 is released.
@dc740
Copy link

dc740 commented Feb 11, 2024

Hey, the list of incompatibilities grew longer.

❯ z 3d_designs
Error:   × Automatically spreading lists is deprecated
    ╭─[/home/user1/.zoxide.nu:30:1]
 30 │   } else {
 31 │     (zoxide query --exclude $env.PWD -- $rest | str trim -r -c "\n")
    ·                                         ──┬──
    ·                                           ╰── Spreading lists automatically when calling external commands is deprecated and will be removed in 0.91.
 32 │   }
    ╰────
  help: Use the spread operator (put a '...' before the argument)


[WARN] - (starship::utils): Executing command "/usr/bin/git" timed out.
[WARN] - (starship::utils): You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing.

Which can also be added as a workaround because there are two places where -- $rest is used

zoxide init nushell | str replace "-- $rest" "-- ...$rest" --all | str replace "def-env" "def --env" --all | save -f ~/.zoxide.nu

nevermind. I found the PR
#663

nagromc added a commit to nagromc/dotfiles that referenced this issue Feb 15, 2024
This reverts commit 9128641.

zoxide v0.9.3 has been released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants