Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: Report hidden columns in summary line
Maximilian Roosd12ca3d58ff1
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rsindex 4502685c9..58f40e50e 100644--- a/src/commands/list/layout.rs+++ b/src/commands/list/layout.rs@@ -291,6 +291,7 @@ pub struct LayoutConfig {pub columns: Vec<ColumnLayout>,pub common_prefix: PathBuf,pub max_message_len: usize,+ pub hidden_nonempty_count: usize,}#[derive(Clone, Copy, Debug)]@@ -541,6 +542,12 @@ pub fn calculate_responsive_layout(candidates.sort_by_key(|candidate| candidate.priority);+ // Store which candidates have data for later calculation of hidden columns+ let candidates_with_data: Vec<_> = candidates+ .iter()+ .map(|c| (c.spec.kind, column_has_data(c.spec.kind, &data_flags)))+ .collect();+const MIN_MESSAGE: usize = 20;const PREFERRED_MESSAGE: usize = 50;const MAX_MESSAGE: usize = 100;@@ -629,10 +636,19 @@ pub fn calculate_responsive_layout(});}+ // Count how many non-empty columns were hidden (not allocated)+ let allocated_kinds: std::collections::HashSet<_> =+ columns.iter().map(|col| col.kind).collect();+ let hidden_nonempty_count = candidates_with_data+ .iter()+ .filter(|(kind, has_data)| !allocated_kinds.contains(kind) && *has_data)+ .count();+LayoutConfig {columns,common_prefix,max_message_len,+ hidden_nonempty_count,}}diff --git a/src/commands/list/mod.rs b/src/commands/list/mod.rsindex 124afa9b1..73a9e3df0 100644--- a/src/commands/list/mod.rs+++ b/src/commands/list/mod.rs@@ -113,14 +113,14 @@ pub fn handle_list(for item in &items {format_list_item_line(item, &layout, current_worktree_path.as_ref());}- display_summary(&items, show_branches);+ display_summary(&items, show_branches, &layout);}}Ok(())}-fn display_summary(items: &[ListItem], include_branches: bool) {+fn display_summary(items: &[ListItem], include_branches: bool, layout: &layout::LayoutConfig) {use anstyle::Style;if items.is_empty() {@@ -164,6 +164,18 @@ fn display_summary(items: &[ListItem], include_branches: bool) {parts.push(format!("{} behind", metrics.behind_items));}+ if layout.hidden_nonempty_count > 0 {+ let plural = if layout.hidden_nonempty_count == 1 {+ "column"+ } else {+ "columns"+ };+ parts.push(format!(+ "{} {} hidden",+ layout.hidden_nonempty_count, plural+ ));+ }+let summary = parts.join(", ");println!("{INFO_EMOJI} {dim}Showing {summary}{dim:#}");}diff --git a/tests/integration_tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snap b/tests/integration_tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snapindex 2b4cc1424..e476d7f45 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_worktrees.snap@@ -12,7 +12,7 @@ info:LC_ALL: CNO_COLOR: ""SOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkVX55R/test-config.toml+ WORKTRUNK_CONFIG: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpQaBYb5/test-config.toml---success: trueexit_code: 0@@ -21,6 +21,6 @@ Branch Status Working ± Main ↕ Path Commit Agefeature ./test-repo.feature 72413a3b 10 months agomain ∅↓ ↓1 ./test-repo.main 6c3da842 10 months ago-⚪ Showing 2 worktrees, 1 behind+⚪ Showing 2 worktrees, 1 behind, 1 column hidden----- stderr -----