Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(shell): stop Nushell 0.116 warning that the wt completer's spans input is deprecated (#4297)

Worktrunk Bote4b0f8151f1f
diff --git a/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap b/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap
index a5bafff0f..ed47f3d4b 100644
--- a/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap
+++ b/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap
@@ -8,7 +8,13 @@ expression: output
# Note: nushell's completion engine bypasses custom completers when the current
# token starts with `-`, so flag completions (e.g. `wt switch --<TAB>`) don't
# appear. Subcommand and value completions work. (nushell/nushell#14504)
-export def "nu-complete wt" [spans: list<string>] {
+#
+# Nushell 0.116 binds completer inputs by parameter name and hands `place` a
+# record whose `command` field is the old spans list; a parameter still named
+# `spans` works but warns as deprecated every time this file is sourced.
+# Earlier versions pass the spans list positionally, whatever the name.
+export def "nu-complete wt" [place] {
+ let spans = if ($place | describe | str starts-with "record") { $place.command } else { $place }
let worktrunk_bin = if ($env.WORKTRUNK_BIN? | is-not-empty) {
$env.WORKTRUNK_BIN
} else {
diff --git a/templates/nushell.nu b/templates/nushell.nu
index 43e7edab7..bb7daf6eb 100644
--- a/templates/nushell.nu
+++ b/templates/nushell.nu
@@ -4,7 +4,13 @@
# Note: nushell's completion engine bypasses custom completers when the current
# token starts with `-`, so flag completions (e.g. `wt switch --<TAB>`) don't
# appear. Subcommand and value completions work. (nushell/nushell#14504)
-export def "nu-complete {{ cmd }}" [spans: list<string>] {
+#
+# Nushell 0.116 binds completer inputs by parameter name and hands `place` a
+# record whose `command` field is the old spans list; a parameter still named
+# `spans` works but warns as deprecated every time this file is sourced.
+# Earlier versions pass the spans list positionally, whatever the name.
+export def "nu-complete {{ cmd }}" [place] {
+ let spans = if ($place | describe | str starts-with "record") { $place.command } else { $place }
let worktrunk_bin = if ($env.WORKTRUNK_BIN? | is-not-empty) {
$env.WORKTRUNK_BIN
} else {