Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: Capitalize command phase names for display
Maximilian Roos962d6949fe7a
diff --git a/src/config/commands.rs b/src/config/commands.rsindex b929b47fa..bacfbd440 100644--- a/src/config/commands.rs+++ b/src/config/commands.rs@@ -7,7 +7,7 @@ use indexmap::IndexMap;use serde::{Deserialize, Serialize};/// Phase in which a command executes-#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::Display, strum::AsRefStr)]+#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::AsRefStr)]#[strum(serialize_all = "kebab-case")]pub enum CommandPhase {/// After creating a worktree (blocking)@@ -22,6 +22,18 @@ pub enum CommandPhase {PostMerge,}+impl std::fmt::Display for CommandPhase {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ let s = self.as_ref();+ // Capitalize first letter: "pre-commit" -> "Pre-commit"+ let mut chars = s.chars();+ match chars.next() {+ None => Ok(()),+ Some(first) => write!(f, "{}{}", first.to_uppercase(), chars.as_str()),+ }+ }+}+/// Represents a command with its template and optionally expanded form#[derive(Debug, Clone, PartialEq)]pub struct Command {diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snapindex cf0326374..bc0f3311a 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap@@ -4,7 +4,7 @@ expression: combined---exit_code: 0----- stdout ------βͺ [2mpost-create declined[0m+βͺ [2mPost-create declined[0mβ [32mCreated new worktree for [1m[32mtest-mixed[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-mixed[0m[0mπ‘π‘ [2mTo enable automatic cd, run: wt config shell[0m@@ -13,10 +13,10 @@ exit_code: 0π‘ [33m[1m[33mtest-repo[0m[33m wants to execute [1m[33m2[0m[33m commands:[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'First command'[0m[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'Third command'[0m[0mπ‘ Allow and remember? [1m[y/N][0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snapindex 309fa4e5e..117efc135 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap@@ -4,7 +4,7 @@ expression: combined---exit_code: 0----- stdout ------βͺ [2mpost-create declined[0m+βͺ [2mPost-create declined[0mβ [32mCreated new worktree for [1m[32mtest/nested-branch[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-nested-branch[0m[0mπ‘π‘ [2mTo enable automatic cd, run: wt config shell[0m@@ -13,16 +13,16 @@ exit_code: 0π‘ [33m[1m[33mtest-repo[0m[33m wants to execute [1m[33m4[0m[33m commands:[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'Branch: test-nested-branch'[0m[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'Worktree: [REPO].test-nested-branch'[0m[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'Repo: test-repo'[0m[0m-π post-create:+π Post-create:[40m [0m [1m[34mcd[0m [REPO].test-nested-branch [36m&&[0m [1m[34mpwd[0m[0mπ‘ Allow and remember? [1m[y/N][0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snapindex fd86d0cc3..3460b2ddf 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap@@ -4,7 +4,7 @@ expression: combined---exit_code: 0----- stdout ------βͺ [2mpost-create declined[0m+βͺ [2mPost-create declined[0mβ [32mCreated new worktree for [1m[32mtest-named[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-named[0m[0mπ‘π‘ [2mTo enable automatic cd, run: wt config shell[0m@@ -13,13 +13,13 @@ exit_code: 0π‘ [33m[1m[33mtest-repo[0m[33m wants to execute [1m[33m3[0m[33m commands:[0m-π post-create [1minstall[0m:+π Post-create [1minstall[0m:[40m [0m [1m[34mecho[0m [32m'Installing dependencies...'[0m[0m-π post-create [1mbuild[0m:+π Post-create [1mbuild[0m:[40m [0m [1m[34mecho[0m [32m'Building project...'[0m[0m-π post-create [1mtest[0m:+π Post-create [1mtest[0m:[40m [0m [1m[34mecho[0m [32m'Running tests...'[0m[0mπ‘ Allow and remember? [1m[y/N][0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snapindex ac3446f27..5044ccd00 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap@@ -4,7 +4,7 @@ expression: combined---exit_code: 0----- stdout ------βͺ [2mpost-create declined[0m+βͺ [2mPost-create declined[0mβ [32mCreated new worktree for [1m[32mfeature/test-approval[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].feature-test-approval[0m[0mπ‘π‘ [2mTo enable automatic cd, run: wt config shell[0m@@ -13,7 +13,7 @@ exit_code: 0π‘ [33m[1m[33mtest-repo[0m[33m wants to execute [1m[33m1[0m[33m command:[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'Worktree path: [REPO].feature-test-approval'[0m[0mπ‘ Allow and remember? [1m[y/N][0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snapindex 27796facd..f7fde6acc 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap@@ -4,7 +4,7 @@ expression: combined---exit_code: 0----- stdout ------βͺ [2mpost-create declined[0m+βͺ [2mPost-create declined[0mβ [32mCreated new worktree for [1m[32mtest-decline[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-decline[0m[0mπ‘π‘ [2mTo enable automatic cd, run: wt config shell[0m@@ -13,10 +13,10 @@ exit_code: 0π‘ [33m[1m[33mtest-repo[0m[33m wants to execute [1m[33m2[0m[33m commands:[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'First command'[0m[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'Third command'[0m[0mπ‘ Allow and remember? [1m[y/N][0mdiff --git a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snapindex 547b2550b..232527d05 100644--- a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap+++ b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap@@ -4,7 +4,7 @@ expression: combined---exit_code: 0----- stdout ------βͺ [2mpost-create declined[0m+βͺ [2mPost-create declined[0mβ [32mCreated new worktree for [1m[32mtest-force-2[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].test-force-2[0m[0mπ‘π‘ [2mTo enable automatic cd, run: wt config shell[0m@@ -13,7 +13,7 @@ exit_code: 0π‘ [33m[1m[33mtest-repo[0m[33m wants to execute [1m[33m1[0m[33m command:[0m-π post-create:+π Post-create:[40m [0m [1m[34mecho[0m [32m'test command'[0m [36m>[0m output.txt[0mπ‘ Allow and remember? [1m[y/N][0m