Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refactor hint messages to avoid multi-line coverage gaps (#437)
Maximilian Roos401453310b52
diff --git a/src/commands/config.rs b/src/commands/config.rsindex c8f3b20b1..2db382c5f 100644--- a/src/commands/config.rs+++ b/src/commands/config.rs@@ -1196,26 +1196,22 @@ pub fn handle_hints_clear(name: Option<String>) -> anyhow::Result<()> {match name {Some(hint_name) => {- if repo.clear_hint(&hint_name)? {- crate::output::print(success_message(cformat!(- "Cleared hint <bold>{hint_name}</>"- )))?;+ let msg = if repo.clear_hint(&hint_name)? {+ success_message(cformat!("Cleared hint <bold>{hint_name}</>"))} else {- crate::output::print(info_message(cformat!(- "Hint <bold>{hint_name}</> was not set"- )))?;- }+ info_message(cformat!("Hint <bold>{hint_name}</> was not set"))+ };+ crate::output::print(msg)?;}None => {let cleared = repo.clear_all_hints()?;- if cleared == 0 {- crate::output::print(info_message("No hints to clear"))?;+ let msg = if cleared == 0 {+ info_message("No hints to clear")} else {- crate::output::print(success_message(cformat!(- "Cleared <bold>{cleared}</> hint{}",- if cleared == 1 { "" } else { "s" }- )))?;- }+ let suffix = if cleared == 1 { "" } else { "s" };+ success_message(cformat!("Cleared <bold>{cleared}</> hint{suffix}"))+ };+ crate::output::print(msg)?;}}diff --git a/src/output/handlers.rs b/src/output/handlers.rsindex 994d3a264..a52dd79bd 100644--- a/src/output/handlers.rs+++ b/src/output/handlers.rs@@ -390,9 +390,10 @@ pub fn handle_switch_output(.map(|c| c.has_custom_worktree_path()).unwrap_or(false);if !has_custom_config && !repo.has_shown_hint("worktree-path") {- super::print(hint_message(cformat!(+ let hint = hint_message(cformat!("Customize worktree locations: <bright-black>wt config create</>"- )))?;+ ));+ super::print(hint)?;let _ = repo.mark_hint_shown("worktree-path");}}