Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Add bash syntax highlighting to shell command gutters
Maximilian Roos27087472d966
diff --git a/.claude/rules/cli-output-formatting.md b/.claude/rules/cli-output-formatting.mdindex 420ef572b..f3ca14deb 100644--- a/.claude/rules/cli-output-formatting.md+++ b/.claude/rules/cli-output-formatting.md@@ -359,14 +359,18 @@ See `src/commands/list/render.rs` for advanced usage.## Gutter Formatting for Quoted Content-Use `format_with_gutter()` for **external data** — anything read from outside-the application: git output, shell commands, commit messages, config values,-cached data. Gutter visually quotes this content to distinguish it from-application-generated output.+Use gutter formatting for **quoted content** — anything that should be visually+distinguished from application prose:++- **External data**: git output, commit messages, config values, cached data+- **Suggested commands**: shell commands the user might run++Use `format_bash_with_gutter()` for shell commands (applies dimming + syntax+highlighting). Use `format_with_gutter()` for other content (no dimming).**Gutter vs Table:** Tabular data structured by the application should use`output::table()` with markdown formatting via `render_markdown_in_help()`.-Tables are artifacts; gutter is for quoting external data.+Tables are artifacts; gutter is for quoting content.**Linebreaks:** Gutter requires a single newline before it, never double.`output::print()` adds a trailing newline, so messages should not include `\n`:diff --git a/src/git/error.rs b/src/git/error.rsindex 22d1251e7..0c82a8812 100644--- a/src/git/error.rs+++ b/src/git/error.rs@@ -16,7 +16,8 @@ use color_print::{cformat, cwrite};use super::HookType;use crate::path::format_path_for_display;use crate::styling::{- ERROR_EMOJI, HINT_EMOJI, error_message, format_with_gutter, hint_message, info_message,+ ERROR_EMOJI, HINT_EMOJI, error_message, format_bash_with_gutter, format_with_gutter,+ hint_message, info_message,};/// Domain errors for git and worktree operations.@@ -244,7 +245,7 @@ impl std::fmt::Display for GitError {"Cannot create worktree for <bold>{branch}</>: {error_detail}")),hint,- format_with_gutter(&command, "", None)+ format_bash_with_gutter(&command, ""))}diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snapindex ca417e21b..ccd385f63 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap@@ -5,4 +5,4 @@ expression: err.to_string()❌ [31mCannot create worktree for [1mfeature-z[22m: existing worktree at [1m/tmp/repo.feature-z[22m on [1mother-branch[22m[39m💡 [2mSwitch the worktree at [90m/tmp/repo.feature-z[39m to [90mfeature-z[39m[22m-[107m [0m cd /tmp/repo.feature-z && git switch feature-z+[107m [0m [2m[0m[2m[34mcd[0m[2m /tmp/repo.feature-z [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch feature-z[0mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snapindex 8246e5a31..59f569694 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap@@ -15,6 +15,7 @@ info:GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"GIT_CONFIG_SYSTEM: /dev/nullGIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"HOME: "[TEST_HOME]"LANG: CLC_ALL: C@@ -32,4 +33,4 @@ exit_code: 1[0m❌ [31mCannot create worktree for [1mmain[22m: existing worktree at [1m[REPO][22m on [1mfeature[22m[39m💡 [2mSwitch the worktree at [90m[REPO][39m to [90mmain[39m[22m-[107m [0m cd [REPO] && git switch main+[107m [0m [2m[0m[2m[34mcd[0m[2m [REPO] [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch maindiff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snapindex 0349da267..084993507 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap@@ -15,6 +15,7 @@ info:GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"GIT_CONFIG_SYSTEM: /dev/nullGIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"HOME: "[TEST_HOME]"LANG: CLC_ALL: C@@ -32,4 +33,4 @@ exit_code: 1[0m❌ [31mCannot create worktree for [1mfeature[22m: existing worktree at [1m[REPO].feature[22m, detached[39m💡 [2mSwitch the worktree at [90m[REPO].feature[39m to [90mfeature[39m[22m-[107m [0m cd [REPO].feature && git switch feature+[107m [0m [2m[0m[2m[34mcd[0m[2m [REPO].feature [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch featurediff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snapindex b297f3030..e6bafbcce 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap@@ -15,6 +15,7 @@ info:GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"GIT_CONFIG_SYSTEM: /dev/nullGIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"HOME: "[TEST_HOME]"LANG: CLC_ALL: C@@ -32,4 +33,4 @@ exit_code: 1[0m❌ [31mCannot create worktree for [1mfeature[22m: existing worktree at [1m[REPO].feature[22m on [1mbugfix[22m[39m💡 [2mSwitch the worktree at [90m[REPO].feature[39m to [90mfeature[39m[22m-[107m [0m cd [REPO].feature && git switch feature+[107m [0m [2m[0m[2m[34mcd[0m[2m [REPO].feature [0m[2m[36m&&[0m[2m [0m[2m[34mgit[0m[2m switch feature