PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: rsteube/carapace (go)

Issue:
nushell has deprecated let-env
### Current Behavior

Like the issue highlighted in https://github.com/rsteube/carapace-bin/issues/1761, carapace completion should use `$env.` instead of `let-env`

### Expected Behavior

Carapace should set the environment correctly for nushell completion

### Steps To Reproduce

```nushell
> 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

- [X] Linux
- [X] OSX
- [X] Windows

### Shell

- [ ] Bash
- [ ] Elvish
- [ ] Fish
- [X] Nushell
- [ ] Oil
- [ ] Powershell
- [ ] Xonsh
- [ ] Zsh

### Anything else?

_No response_

Pull request:
nushell: fix snippet
fix #937

Patch:
diff --git a/internal/shell/nushell/snippet.go b/internal/shell/nushell/snippet.go
index 72357e4..a37f698 100644
--- a/internal/shell/nushell/snippet.go
+++ b/internal/shell/nushell/snippet.go
@@ -10,19 +10,7 @@ import (
 
 // Snippet creates the nushell completion script.
 func Snippet(cmd *cobra.Command) string {
-	return fmt.Sprintf(`let external_completer = {|spans| 
-  {
-    $spans.0: { } # default
-    %v: { %v _carapace nushell $spans | from json }
-  } | get $spans.0 | each {|it| do $it}
-}
-
-let-env config = {
-  completions: {
-    external: {
-      enable: true
-      completer: $external_completer
-    }
-  }
+	return fmt.Sprintf(`let %v_completer = {|spans| 
+    %v _carapace nushell $spans | from json
 }`, cmd.Name(), uid.Executable())
 }


Test patch:
diff --git a/example/cmd/_test/nushell.nu b/example/cmd/_test/nushell.nu
index 0c0e5b8..fa236bc 100644
--- a/example/cmd/_test/nushell.nu
+++ b/example/cmd/_test/nushell.nu
@@ -1,15 +1,3 @@
-let external_completer = {|spans| 
-  {
-    $spans.0: { } # default
-    example: { example _carapace nushell $spans | from json }
-  } | get $spans.0 | each {|it| do $it}
-}
-
-let-env config = {
-  completions: {
-    external: {
-      enable: true
-      completer: $external_completer
-    }
-  }
+let example_completer = {|spans| 
+    example _carapace nushell $spans | from json
 }