Skip to content

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

feat(config): Show hint if any shell not configured

Maximilian Roos1936f93abddd
diff --git a/src/commands/config.rs b/src/commands/config.rs
index 2ffe63069..c6484539a 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -210,7 +210,6 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {
}
};
- let mut any_configured = false;
let mut any_not_configured = false;
// Show configured and not-configured shells (matching `config shell install` format exactly)
@@ -228,7 +227,6 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {
match result.action {
ConfigAction::AlreadyExists => {
- any_configured = true;
writeln!(
out,
"{INFO_EMOJI} Already configured {what} for {bold}{shell}{bold:#} @ {path}"
@@ -284,7 +282,7 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {
}
// Summary hint
- if any_not_configured && !any_configured {
+ if any_not_configured {
writeln!(out)?;
writeln!(
out,
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 4fdc6776b..01dc13fe0 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -185,6 +185,47 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)
});
}
+/// Test `wt config show` shows hint when some shells configured, some not
+#[test]
+fn test_config_show_partial_shell_config_shows_hint() {
+ let repo = TestRepo::new();
+ let temp_home = TempDir::new().unwrap();
+
+ // Create global config
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(global_config_dir.join("config.toml"), "").unwrap();
+
+ // Create .bashrc WITHOUT wt integration
+ fs::write(
+ temp_home.path().join(".bashrc"),
+ r#"# Some bash config
+export PATH="$HOME/bin:$PATH"
+"#,
+ )
+ .unwrap();
+
+ // Create .zshrc WITH wt integration
+ fs::write(
+ temp_home.path().join(".zshrc"),
+ r#"# wt integration
+if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)"; fi
+"#,
+ )
+ .unwrap();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.clean_cli_env(&mut cmd);
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WT_ASSUME_COMPINIT", "1"); // Bypass zsh subprocess check
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
/// Test `wt config show` shows no warning when zsh compinit is enabled
#[test]
fn test_config_show_zsh_compinit_correct_order() {
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
new file mode 100644
index 000000000..9e091fc39
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
@@ -0,0 +1,40 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - show
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_BIN: ""
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WT_ASSUME_COMPINIT: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+⚪ Global Config: ~/.config/worktrunk/config.toml
+💡 Empty file (using defaults)
+
+⚪ Project Config: [REPO]/.config/wt.toml
+💡 Not found
+
+💡 Not configured shell extension & completions for bash @ ~/.bashrc
+⚪ Already configured shell extension & completions for zsh @ ~/.zshrc
+⚪ Skipped fish; ~/.config/fish/conf.d not found
+
+💡 Run 'wt config shell install' to enable shell integration