Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Unify the last two deprecation warnings to the standard pattern (#2153)
Maximilian Roos01f6082b0694
diff --git a/src/config/deprecation.rs b/src/config/deprecation.rsindex 3b58a5944..9ea5a5953 100644--- a/src/config/deprecation.rs+++ b/src/config/deprecation.rs@@ -1367,20 +1367,13 @@ pub fn format_deprecation_warnings(info: &DeprecationInfo) -> String {use std::fmt::Write;let mut out = String::new();- if !info.deprecations.vars.is_empty() {- let var_list: Vec<String> = info- .deprecations- .vars- .iter()- .map(|(old, new)| cformat!("<dim>{}</> → <bold>{}</>", old, new))- .collect();+ for (old, new) in &info.deprecations.vars {let _ = writeln!(out,"{}",- warning_message(format!(- "{} uses deprecated template variables: {}",- info.label,- var_list.join(", ")+ warning_message(cformat!(+ "{label}: template variable <bold>{old}</> is deprecated in favor of <bold>{new}</>",+ label = info.label,)));}@@ -1411,8 +1404,8 @@ pub fn format_deprecation_warnings(info: &DeprecationInfo) -> String {let _ = writeln!(out,"{}",- warning_message(format!(- "{} has approved-commands in [projects] sections (moved to approvals.toml)",+ warning_message(cformat!(+ "{}: <bold>approved-commands</> under <bold>[projects]</> is deprecated in favor of <bold>approvals.toml</>",info.label)));diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snapindex f6ebd9f38..f7a98d10f 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap@@ -48,7 +48,7 @@ exit_code: 0[2m↳[22m [2mNot found; to create one, run [4mwt config create[24m[22m[36mPROJECT CONFIG[39m @ _REPO_/.config/wt.toml-[33m▲[39m [33mProject config uses deprecated template variables: [2mmain_worktree[22m → [1mrepo[22m[39m+[33m▲[39m [33mProject config: template variable [1mmain_worktree[22m is deprecated in favor of [1mrepo[22m[39m[33m▲[39m [33mProject config: [1mpost-create[22m hook is deprecated in favor of [1mpre-start[22m[39m[2m↳[22m [2mTo apply: [4mwt config update[24m[22m[2m○[22m Proposed diff:diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snapindex af092f99d..53899e278 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap@@ -45,7 +45,8 @@ exit_code: 0----- stderr -----[36mUSER CONFIG[39m @ ~/.config/worktrunk/config.toml-[33m▲[39m [33mUser config uses deprecated template variables: [2mrepo_root[22m → [1mrepo_path[22m, [2mmain_worktree[22m → [1mrepo[22m[39m+[33m▲[39m [33mUser config: template variable [1mrepo_root[22m is deprecated in favor of [1mrepo_path[22m[39m+[33m▲[39m [33mUser config: template variable [1mmain_worktree[22m is deprecated in favor of [1mrepo[22m[39m[33m▲[39m [33mUser config: [1mpost-create[22m hook is deprecated in favor of [1mpre-start[22m[39m[2m↳[22m [2mTo apply: [4mwt config update[24m[22m[2m○[22m Proposed diff:diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snapindex 82c1e044a..487c204ee 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap@@ -48,7 +48,7 @@ exit_code: 0[2m↳[22m [2mNot found; to create one, run [4mwt config create[24m[22m[36mPROJECT CONFIG[39m @ [PROJECT_ID]-[33m▲[39m [33mProject config uses deprecated template variables: [2mmain_worktree[22m → [1mrepo[22m[39m+[33m▲[39m [33mProject config: template variable [1mmain_worktree[22m is deprecated in favor of [1mrepo[22m[39m[33m▲[39m [33mProject config: [1mpost-create[22m hook is deprecated in favor of [1mpre-start[22m[39m[2m↳[22m [2mTo apply: [4mwt -C _REPO_ config update[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snapindex d7c7c057d..06d03d93d 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap@@ -45,7 +45,7 @@ exit_code: 0----- stdout ---------- stderr ------[33m▲[39m [33mUser config has approved-commands in [projects] sections (moved to approvals.toml)[39m+[33m▲[39m [33mUser config: [1mapproved-commands[22m under [1m[projects][22m is deprecated in favor of [1mapprovals.toml[22m[39m[2m↳[22m [2mCopied approved commands to [4mapprovals.toml[24m[22m[2m○[22m Proposed diff:[107m [0m [1mdiff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW][mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snapindex a7ddcb203..408b0db63 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap@@ -45,7 +45,9 @@ exit_code: 0----- stdout ---------- stderr ------[33m▲[39m [33mUser config uses deprecated template variables: [2mrepo_root[22m → [1mrepo_path[22m, [2mworktree[22m → [1mworktree_path[22m, [2mmain_worktree[22m → [1mrepo[22m[39m+[33m▲[39m [33mUser config: template variable [1mrepo_root[22m is deprecated in favor of [1mrepo_path[22m[39m+[33m▲[39m [33mUser config: template variable [1mworktree[22m is deprecated in favor of [1mworktree_path[22m[39m+[33m▲[39m [33mUser config: template variable [1mmain_worktree[22m is deprecated in favor of [1mrepo[22m[39m[33m▲[39m [33mUser config: [1mpost-create[22m hook is deprecated in favor of [1mpre-start[22m[39m[2m○[22m Proposed diff:[107m [0m [1mdiff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW][mdiff --git a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snapindex 2a37955b1..22e0b81dd 100644--- a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap+++ b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap@@ -2,7 +2,8 @@source: tests/integration_tests/config_update_pty.rsexpression: "&output"----[33m▲[39m [33mUser config uses deprecated template variables: [2mrepo_root[22m → [1mrepo_path[22m, [2mmain_worktree[22m → [1mrepo[22m[39m+[33m▲[39m [33mUser config: template variable [1mrepo_root[22m is deprecated in favor of [1mrepo_path[22m[39m+[33m▲[39m [33mUser config: template variable [1mmain_worktree[22m is deprecated in favor of [1mrepo[22m[39m[33m▲[39m [33mUser config: [1mpost-create[22m hook is deprecated in favor of [1mpre-start[22m[39m[2m○[22m Proposed diff:[107m [0m [1mdiff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW][mdiff --git a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snapindex b10d3defa..27336407a 100644--- a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap+++ b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap@@ -2,7 +2,8 @@source: tests/integration_tests/config_update_pty.rsexpression: "&output"----[33m▲[39m [33mUser config uses deprecated template variables: [2mrepo_root[22m → [1mrepo_path[22m, [2mmain_worktree[22m → [1mrepo[22m[39m+[33m▲[39m [33mUser config: template variable [1mrepo_root[22m is deprecated in favor of [1mrepo_path[22m[39m+[33m▲[39m [33mUser config: template variable [1mmain_worktree[22m is deprecated in favor of [1mrepo[22m[39m[33m▲[39m [33mUser config: [1mpost-create[22m hook is deprecated in favor of [1mpre-start[22m[39m[2m○[22m Proposed diff:[107m [0m [1mdiff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW][m