nushell has deprecated let-env
fuhrmannb opened this issue · 3 comments
Current Behavior
Like the issue highlighted in carapace-sh/carapace-bin#1761, carapace completion should use $env.
instead of let-env
Expected Behavior
Carapace should set the environment correctly for nushell completion
Steps To Reproduce
> my-cool-cmd _carapace nushell | save --force ~/.cache/my-cool-cmd/init.nu
> source ~/.cache/my-cool-cmd/init.nu
Error: nu::shell::removed_command
× Removed command: let-env
╭─[C:\Users\me\.cache\my-cool-cmd\init.nu:7:1]
7 │
8 │ let-env config = {
· ───┬───
· ╰── 'let-env' has been removed from Nushell. Please use '$env.<environment variable> = ...' instead.
9 │ completions: {
╰────
Version
v0.44.0
OS
- Linux
- OSX
- Windows
Shell
- Bash
- Elvish
- Fish
- Nushell
- Oil
- Powershell
- Xonsh
- Zsh
Anything else?
No response
Ah, thought I had fixed that already.
Think it's best to just define the completer as function here.
Nushell so far has no common approach to register a custom completer dynamically.
So this code snippet is only an instruction and not really sourceable.
With the change it can be used like this after sourcing:
do $my-cool-cmd_completer $spans
do $my-cool-cmd_completer [my-cool-cmd, ""]
Adaptions to external_completer
in config.nu
are done manually though.
If carapace-bin is used the best approach would be to bridge it using a spec:
# ~/.config/carapace/specs/my-cool-cmd.yaml
name: my-cool-cmd
completion:
positionalany: ["$_bridge.Carapace([my-cool-cmd])"]
Thanks for the quick fix.
However I believe there is still some let-env
in the Dockerfile, see this GitHub search:
Will have a look at that, thanks.