Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(shell): correct shell-extension label inversion for nu/pwsh (#2699)
Worktrunk Bot2b0c0f3f9986
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rsindex 420015b5a..0613e0415 100644--- a/src/commands/config/show.rs+++ b/src/commands/config/show.rs@@ -751,13 +751,16 @@ fn render_fish_legacy_migration(Ok(())}-/// Per-shell label distinguishing fish (separate completion file) from-/// bash/zsh (inline completions).+/// Per-shell label distinguishing bash/zsh (inline completions) from+/// everyone else (no inline completions: fish ships a separate completion+/// file; nushell and powershell have no completions). Mirrors+/// `output::shell_integration::shell_extension_label` and the equivalent+/// switch in `commands::configure_shell`.fn what_label(shell: Shell) -> &'static str {- if matches!(shell, Shell::Fish) {- "shell extension"- } else {+ if matches!(shell, Shell::Bash | Shell::Zsh) {"shell extension & completions"+ } else {+ "shell extension"}}diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rsindex 7d41bef78..4437c3a47 100644--- a/src/commands/configure_shell.rs+++ b/src/commands/configure_shell.rs@@ -750,11 +750,14 @@ pub fn show_uninstall_preview(result.action.description(),);} else {- // Bash/Zsh: inline completions; Fish: separate completion file- let what = if matches!(shell, Shell::Fish) {- "shell extension"- } else {+ // Only Bash/Zsh ship inline completions alongside the extension;+ // Fish/Nushell/PowerShell either use a separate completion file+ // (Fish) or no completions at all. Keep this in sync with+ // `show_install_preview` and `prompt_for_uninstall_confirmation`.+ let what = if matches!(shell, Shell::Bash | Shell::Zsh) {"shell extension & completions"+ } else {+ "shell extension"};eprintln!(diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rsindex 21cd8e24c..d68cfca54 100644--- a/tests/integration_tests/configure_shell.rs+++ b/tests/integration_tests/configure_shell.rs@@ -1655,6 +1655,55 @@ fn test_uninstall_shell_dry_run_multiple(repo: TestRepo, temp_home: TempDir) {);}+/// Regression: `--dry-run uninstall nu` (and pwsh by extension) previously+/// printed `Would remove shell extension & completions for nu`, but Nushell+/// has no inline completions — only Bash/Zsh do. The other two render paths+/// (`show_install_preview`, `prompt_for_uninstall_confirmation`) already+/// keyed off `Shell::Bash | Shell::Zsh`; the dry-run uninstall path was the+/// odd one out, treating Fish as the only no-completions shell.+#[rstest]+fn test_uninstall_shell_dry_run_nushell(repo: TestRepo, temp_home: TempDir) {+ // Install nushell integration first so dry-run uninstall finds something.+ let mut install_cmd = wt_command();+ repo.configure_wt_cmd(&mut install_cmd);+ set_temp_home_env(&mut install_cmd, temp_home.path());+ install_cmd.env("SHELL", "/bin/nu");+ install_cmd+ .args(["config", "shell", "install", "nu", "--yes"])+ .current_dir(repo.root_path());+ let install_output = install_cmd.output().expect("Failed to execute install");+ assert!(+ install_output.status.success(),+ "Install precondition failed:\nstderr: {}",+ String::from_utf8_lossy(&install_output.stderr)+ );++ let mut cmd = wt_command();+ repo.configure_wt_cmd(&mut cmd);+ set_temp_home_env(&mut cmd, temp_home.path());+ cmd.env("SHELL", "/bin/nu");+ cmd.args(["config", "shell", "uninstall", "nu", "--dry-run"])+ .current_dir(repo.root_path());++ let output = cmd.output().expect("Failed to execute uninstall");+ assert!(+ output.status.success(),+ "Dry-run uninstall should succeed:\nstderr: {}",+ String::from_utf8_lossy(&output.stderr)+ );++ let stderr = String::from_utf8_lossy(&output.stderr);+ assert!(+ stderr.contains("shell extension for") && stderr.contains("nu"),+ "Dry-run output should label nushell as 'shell extension' (no '& completions'):\n{stderr}"+ );+ assert!(+ !stderr.contains("shell extension & completions for [1mnu")+ && !stderr.contains("shell extension & completions for nu"),+ "Nushell must NOT be labeled 'shell extension & completions':\n{stderr}"+ );+}+// PTY-based tests for interactive install preview#[cfg(all(unix, feature = "shell-integration-tests"))]mod pty_tests {