Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: Add Fish tab-completion for nested subcommands
Maximilian Roos2b0e55629087
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rsindex 281a5a72c..84707632c 100644--- a/src/commands/list/layout.rs+++ b/src/commands/list/layout.rs@@ -6,12 +6,29 @@ use super::model::ListItem;/// Helper: Try to allocate space for a column. Returns the allocated width if successful./// Updates `remaining` by subtracting the allocated width + spacing.-fn try_allocate(remaining: &mut usize, ideal_width: usize, spacing: usize) -> usize {- if ideal_width == 0 || *remaining < ideal_width + spacing {+/// If is_first is true, doesn't require spacing before the column.+///+/// The spacing is consumed from the budget (subtracted from `remaining`) but not returned+/// as part of the column's width, since the spacing appears before the column content.+fn try_allocate(+ remaining: &mut usize,+ ideal_width: usize,+ spacing: usize,+ is_first: bool,+) -> usize {+ if ideal_width == 0 {return 0;}- *remaining = remaining.saturating_sub(ideal_width + spacing);- ideal_width+ let required = if is_first {+ ideal_width+ } else {+ ideal_width + spacing // Gap before column + column content+ };+ if *remaining < required {+ return 0;+ }+ *remaining = remaining.saturating_sub(required);+ ideal_width // Return just the column width}/// Width information for diff columns (e.g., "+128 -147")@@ -41,6 +58,8 @@ pub struct ColumnWidths {pub branch_diff: DiffWidths,pub upstream: usize,pub states: usize,+ pub commit: usize,+ pub path: usize,}pub struct LayoutConfig {@@ -175,6 +194,8 @@ pub fn calculate_column_widths(items: &[ListItem]) -> ColumnWidths {},upstream: final_upstream,states: final_states,+ commit: 8, // Fixed width for short commit hash+ path: 0, // Path width calculated later in responsive layout}}@@ -202,35 +223,27 @@ pub fn calculate_responsive_layout(items: &[ListItem]) -> LayoutConfig {.max().unwrap_or(20); // fallback to 20 if no paths- // Essential columns (always shown):- // - branch: variable- // - short HEAD: 8 chars- // - path: variable (calculated above)- // - spacing: 2 chars between columns-let spacing = 2;- let short_head = 8;-- // Calculate base width needed- let base_width = ideal_widths.branch + spacing + short_head + spacing + max_path_width;-- // Available width for optional columns- let available = terminal_width.saturating_sub(base_width);+ let commit_width = 8; // Short commit hash// Priority order for columns (from high to low):- // 1. time (15-20 chars)- // 2. message (20-50 chars, flexible)- // 3. ahead_behind - commits difference- // 4. working_diff - line diff in working tree- // 5. branch_diff - line diff in commits- // 6. upstream- // 7. states+ // 1. branch - identity (what is this?)+ // 2. working_diff - uncommitted changes (CRITICAL: do I need to commit?)+ // 3. ahead_behind - commits difference (CRITICAL: am I ahead/behind?)+ // 4. states - special states like [rebasing] (rare but urgent when present)+ // 5. path - location (where is this?)+ // 6. branch_diff - line diff in commits (work volume understanding)+ // 7. upstream - tracking configuration (sync context)+ // 8. time - recency (nice-to-have context)+ // 9. commit - hash (reference info, rarely needed)+ // 10. message - description (nice-to-have, space-hungry)//// Each column is shown if it has any data (ideal_width > 0) and fits in remaining space.+ // All columns participate in priority allocation - nothing is "essential".- let mut remaining = available;+ let mut remaining = terminal_width;let mut widths = ColumnWidths {- branch: ideal_widths.branch,+ branch: 0,time: 0,message: 0,ahead_behind: 0,@@ -238,64 +251,79 @@ pub fn calculate_responsive_layout(items: &[ListItem]) -> LayoutConfig {branch_diff: DiffWidths::zero(),upstream: 0,states: 0,+ commit: 0,+ path: 0,};- // Time column (high priority, ~15 chars)- widths.time = try_allocate(&mut remaining, ideal_widths.time, spacing);-- // Message column (flexible, 20-50 chars)- let max_message_len = if remaining >= 50 + spacing {- remaining = remaining.saturating_sub(50 + spacing);- 50- } else if remaining >= 30 + spacing {- let msg_len = remaining.saturating_sub(spacing).min(ideal_widths.message);- remaining = remaining.saturating_sub(msg_len + spacing);- msg_len- } else if remaining >= 20 + spacing {- let msg_len = 20;- remaining = remaining.saturating_sub(msg_len + spacing);- msg_len- } else {- 0- };-- if max_message_len > 0 {- widths.message = max_message_len.min(ideal_widths.message);- }-- // Ahead/behind column (if it has data and fits)- widths.ahead_behind = try_allocate(&mut remaining, ideal_widths.ahead_behind, spacing);+ // Branch column (highest priority - identity)+ widths.branch = try_allocate(&mut remaining, ideal_widths.branch, spacing, true);- // Working diff column (if it has data and fits)- let allocated_width = try_allocate(&mut remaining, ideal_widths.working_diff.total, spacing);+ // Working diff column (critical - uncommitted changes)+ let allocated_width = try_allocate(+ &mut remaining,+ ideal_widths.working_diff.total,+ spacing,+ false,+ );if allocated_width > 0 {widths.working_diff = ideal_widths.working_diff;}- // Branch diff column (if it has data and fits)- let allocated_width = try_allocate(&mut remaining, ideal_widths.branch_diff.total, spacing);+ // Ahead/behind column (critical sync status)+ widths.ahead_behind = try_allocate(&mut remaining, ideal_widths.ahead_behind, spacing, false);++ // States column (rare but urgent when present)+ widths.states = try_allocate(&mut remaining, ideal_widths.states, spacing, false);++ // Path column (location - important for navigation)+ widths.path = try_allocate(&mut remaining, max_path_width, spacing, false);++ // Branch diff column (work volume)+ let allocated_width = try_allocate(+ &mut remaining,+ ideal_widths.branch_diff.total,+ spacing,+ false,+ );if allocated_width > 0 {widths.branch_diff = ideal_widths.branch_diff;}- // Upstream column (if it has data and fits)- widths.upstream = try_allocate(&mut remaining, ideal_widths.upstream, spacing);+ // Upstream column (sync configuration)+ widths.upstream = try_allocate(&mut remaining, ideal_widths.upstream, spacing, false);++ // Time column (contextual information)+ widths.time = try_allocate(&mut remaining, ideal_widths.time, spacing, false);++ // Commit column (reference hash - rarely needed)+ widths.commit = try_allocate(&mut remaining, commit_width, spacing, false);- // States column (if it has data and fits)- widths.states = try_allocate(&mut remaining, ideal_widths.states, spacing);+ // Message column (flexible width: min 20, preferred 50, max 100)+ const MIN_MESSAGE: usize = 20;+ const PREFERRED_MESSAGE: usize = 50;+ const MAX_MESSAGE: usize = 100;- // Expand message column with any leftover space (up to 100 chars total)- let final_max_message_len = if widths.message > 0 && remaining > 0 {- let max_expansion = 100_usize.saturating_sub(max_message_len);- let expansion = remaining.saturating_sub(spacing).min(max_expansion);- let new_len = max_message_len + expansion;- let allocated_len = new_len.min(ideal_widths.message);- widths.message = allocated_len;- allocated_len // Return the actual allocated width, not new_len+ let message_width = if remaining >= PREFERRED_MESSAGE + spacing {+ PREFERRED_MESSAGE+ } else if remaining >= MIN_MESSAGE + spacing {+ remaining.saturating_sub(spacing).min(ideal_widths.message)} else {- max_message_len+ 0};+ if message_width > 0 {+ remaining = remaining.saturating_sub(message_width + spacing);+ widths.message = message_width.min(ideal_widths.message);++ // Expand with any leftover space (up to MAX_MESSAGE total)+ if remaining > 0 {+ let expansion = remaining.min(MAX_MESSAGE.saturating_sub(widths.message));+ widths.message += expansion;+ }+ }++ let final_max_message_len = widths.message;+LayoutConfig {widths,common_prefix,diff --git a/src/commands/list/render.rs b/src/commands/list/render.rsindex e69ab8cab..3e5e3119c 100644--- a/src/commands/list/render.rs+++ b/src/commands/list/render.rs@@ -94,16 +94,16 @@ pub fn format_header_line(layout: &LayoutConfig) {let dim = Style::new().dimmed();let mut line = StyledLine::new();- push_header(&mut line, "Branch", widths.branch, dim);- push_optional_header(&mut line, "Age", widths.time, dim);+ push_optional_header(&mut line, "Branch", widths.branch, dim);+ push_optional_header(&mut line, "WT +/-", widths.working_diff.total, dim);push_optional_header(&mut line, "Cmts", widths.ahead_behind, dim);+ push_optional_header(&mut line, "State", widths.states, dim);+ push_optional_header(&mut line, "Path", widths.path, dim);push_optional_header(&mut line, "Cmt +/-", widths.branch_diff.total, dim);- push_optional_header(&mut line, "WT +/-", widths.working_diff.total, dim);push_optional_header(&mut line, "Remote", widths.upstream, dim);- push_header(&mut line, "Commit", 8, dim);+ push_optional_header(&mut line, "Age", widths.time, dim);+ push_optional_header(&mut line, "Commit", widths.commit, dim);push_optional_header(&mut line, "Message", widths.message, dim);- push_optional_header(&mut line, "State", widths.states, dim);- line.push_styled("Path", dim);println!("{}", line.render());}@@ -160,29 +160,41 @@ pub fn format_list_item_line(// Start building the linelet mut line = StyledLine::new();+ let mut first_column = true;++ // Helper to add gap before column if not first+ let mut push_gap_if_needed = |line: &mut StyledLine| {+ if !first_column {+ push_gap(line);+ }+ first_column = false;+ };// Branch name- let branch_text = format!("{:width$}", item.branch_name(), width = widths.branch);- if let Some(style) = text_style {- line.push_styled(branch_text, style);- } else {- line.push_raw(branch_text);+ if widths.branch > 0 {+ push_gap_if_needed(&mut line);+ let branch_text = format!("{:width$}", item.branch_name(), width = widths.branch);+ if let Some(style) = text_style {+ line.push_styled(branch_text, style);+ } else {+ line.push_raw(branch_text);+ }}- push_gap(&mut line);- // Age (Time)- if widths.time > 0 {- let time_str = format!(- "{:width$}",- format_relative_time(commit.timestamp),- width = widths.time- );- line.push_styled(time_str, Style::new().dimmed());- push_gap(&mut line);+ // Working tree diff (worktrees only)+ if widths.working_diff.total > 0 {+ push_gap_if_needed(&mut line);+ if let Some(info) = worktree_info {+ let (wt_added, wt_deleted) = info.working_tree_diff;+ push_diff(&mut line, wt_added, wt_deleted, &widths.working_diff);+ } else {+ push_blank(&mut line, widths.working_diff.total);+ }}// Ahead/behind (commits difference)if widths.ahead_behind > 0 {+ push_gap_if_needed(&mut line);if !item.is_primary() {if counts.ahead > 0 || counts.behind > 0 {let ahead_behind_text = format!(@@ -200,32 +212,53 @@ pub fn format_list_item_line(} else {push_blank(&mut line, widths.ahead_behind);}- push_gap(&mut line);}- // Branch diff (line diff in commits)- if widths.branch_diff.total > 0 {- if !item.is_primary() {- push_diff(&mut line, branch_diff.0, branch_diff.1, &widths.branch_diff);+ // States (worktrees only)+ if widths.states > 0 {+ push_gap_if_needed(&mut line);+ if let Some(info) = worktree_info {+ let states = format_all_states(info);+ if !states.is_empty() {+ let states_text = format!("{:width$}", states, width = widths.states);+ line.push_raw(states_text);+ } else {+ push_blank(&mut line, widths.states);+ }} else {- push_blank(&mut line, widths.branch_diff.total);+ push_blank(&mut line, widths.states);}- push_gap(&mut line);}- // Working tree diff (worktrees only)- if widths.working_diff.total > 0 {+ // Path (worktrees only)+ if widths.path > 0 {+ push_gap_if_needed(&mut line);if let Some(info) = worktree_info {- let (wt_added, wt_deleted) = info.working_tree_diff;- push_diff(&mut line, wt_added, wt_deleted, &widths.working_diff);+ let path_str = shorten_path(&info.worktree.path, &layout.common_prefix);+ let path_text = format!("{:width$}", path_str, width = widths.path);+ if let Some(style) = text_style {+ line.push_styled(path_text, style);+ } else {+ line.push_raw(path_text);+ }} else {- push_blank(&mut line, widths.working_diff.total);+ push_blank(&mut line, widths.path);+ }+ }++ // Branch diff (line diff in commits)+ if widths.branch_diff.total > 0 {+ push_gap_if_needed(&mut line);+ if !item.is_primary() {+ push_diff(&mut line, branch_diff.0, branch_diff.1, &widths.branch_diff);+ } else {+ push_blank(&mut line, widths.branch_diff.total);}- push_gap(&mut line);}// Upstream trackingif widths.upstream > 0 {+ push_gap_if_needed(&mut line);if let Some((remote_name, upstream_ahead, upstream_behind)) = upstream.active() {let mut upstream_segment = StyledLine::new();upstream_segment.push_styled(remote_name, Style::new().dimmed());@@ -238,47 +271,33 @@ pub fn format_list_item_line(} else {push_blank(&mut line, widths.upstream);}- push_gap(&mut line);}- // Commit (short HEAD) - always dimmed (reference info)- line.push_styled(short_head, Style::new().dimmed());- push_gap(&mut line);+ // Age (Time)+ if widths.time > 0 {+ push_gap_if_needed(&mut line);+ let time_str = format!(+ "{:width$}",+ format_relative_time(commit.timestamp),+ width = widths.time+ );+ line.push_styled(time_str, Style::new().dimmed());+ }++ // Commit (short HEAD) - dimmed reference info+ if widths.commit > 0 {+ push_gap_if_needed(&mut line);+ line.push_styled(short_head, Style::new().dimmed());+ }// Messageif widths.message > 0 {+ push_gap_if_needed(&mut line);let msg = truncate_at_word_boundary(&commit.commit_message, layout.max_message_len);let msg_start = line.width();line.push_styled(msg, Style::new().dimmed());// Pad to correct visual width (not character count - important for unicode!)line.pad_to(msg_start + widths.message);- push_gap(&mut line);- }-- // States (worktrees only)- if widths.states > 0 {- if let Some(info) = worktree_info {- let states = format_all_states(info);- if !states.is_empty() {- let states_text = format!("{:width$}", states, width = widths.states);- line.push_raw(states_text);- } else {- push_blank(&mut line, widths.states);- }- } else {- push_blank(&mut line, widths.states);- }- push_gap(&mut line);- }-- // Path (worktrees only)- if let Some(info) = worktree_info {- let path_str = shorten_path(&info.worktree.path, &layout.common_prefix);- if let Some(style) = text_style {- line.push_styled(path_str, style);- } else {- line.push_raw(path_str);- }}println!("{}", line.render());@@ -287,186 +306,7 @@ pub fn format_list_item_line(#[cfg(test)]mod tests {use super::*;- use crate::commands::list::layout::{ColumnWidths, LayoutConfig};- use crate::commands::list::model::{- AheadBehind, BranchDiffTotals, CommitDetails, UpstreamStatus, WorktreeInfo,- };- use crate::display::shorten_path;- use std::path::PathBuf;- use worktrunk::styling::StyledLine;-- #[test]- fn test_column_alignment_with_all_columns() {- // Create test data with all columns populated- let info = WorktreeInfo {- worktree: worktrunk::git::Worktree {- path: PathBuf::from("/test/path"),- head: "abc12345".to_string(),- branch: Some("test-branch".to_string()),- bare: false,- detached: false,- locked: Some("test lck".to_string()), // "(locked: test lck)" = 18 chars- prunable: None,- },- commit: CommitDetails {- timestamp: 0,- commit_message: "Test message".to_string(),- },- counts: AheadBehind {- ahead: 3,- behind: 2,- },- working_tree_diff: (100, 50),- branch_diff: BranchDiffTotals { diff: (200, 30) },- is_primary: false,- upstream: UpstreamStatus::from_parts(Some("origin".to_string()), 4, 0),- worktree_state: None,- };-- let layout = LayoutConfig {- widths: ColumnWidths {- branch: 11,- time: 13,- message: 12,- ahead_behind: 5,- working_diff: crate::commands::list::layout::DiffWidths {- total: 8,- added_digits: 3,- deleted_digits: 2,- },- branch_diff: crate::commands::list::layout::DiffWidths {- total: 8,- added_digits: 3,- deleted_digits: 2,- },- upstream: 12,- states: 18,- },- common_prefix: PathBuf::from("/test"),- max_message_len: 12,- };-- // Build header line manually (mimicking format_header_line logic)- let mut header = StyledLine::new();- header.push_raw(format!("{:width$}", "Branch", width = layout.widths.branch));- header.push_raw(" ");- header.push_raw(format!("{:width$}", "Age", width = layout.widths.time));- header.push_raw(" ");- header.push_raw(format!(- "{:width$}",- "Cmts",- width = layout.widths.ahead_behind- ));- header.push_raw(" ");- header.push_raw(format!(- "{:width$}",- "Cmt +/-",- width = layout.widths.branch_diff.total- ));- header.push_raw(" ");- header.push_raw(format!(- "{:width$}",- "WT +/-",- width = layout.widths.working_diff.total- ));- header.push_raw(" ");- header.push_raw(format!(- "{:width$}",- "Remote",- width = layout.widths.upstream- ));- header.push_raw(" ");- header.push_raw("Commit ");- header.push_raw(" ");- header.push_raw(format!(- "{:width$}",- "Message",- width = layout.widths.message- ));- header.push_raw(" ");- header.push_raw(format!("{:width$}", "State", width = layout.widths.states));- header.push_raw(" ");- header.push_raw("Path");-- // Build data line manually (mimicking format_worktree_line logic)- let mut data = StyledLine::new();- data.push_raw(format!(- "{:width$}",- "test-branch",- width = layout.widths.branch- ));- data.push_raw(" ");- data.push_raw(format!(- "{:width$}",- "9 months ago",- width = layout.widths.time- ));- data.push_raw(" ");- // Ahead/behind- let ahead_behind_text = format!("{:width$}", "↑3 ↓2", width = layout.widths.ahead_behind);- data.push_raw(ahead_behind_text);- data.push_raw(" ");- // Branch diff- let mut branch_diff_segment = StyledLine::new();- branch_diff_segment.push_raw("+200 -30");- branch_diff_segment.pad_to(layout.widths.branch_diff.total);- for seg in branch_diff_segment.segments {- data.push(seg);- }- data.push_raw(" ");- // Working diff- let mut working_diff_segment = StyledLine::new();- working_diff_segment.push_raw("+100 -50");- working_diff_segment.pad_to(layout.widths.working_diff.total);- for seg in working_diff_segment.segments {- data.push(seg);- }- data.push_raw(" ");- // Upstream- let mut upstream_segment = StyledLine::new();- upstream_segment.push_raw("origin ↑4 ↓0");- upstream_segment.pad_to(layout.widths.upstream);- for seg in upstream_segment.segments {- data.push(seg);- }- data.push_raw(" ");- // Commit (fixed 8 chars)- data.push_raw("abc12345");- data.push_raw(" ");- // Message- data.push_raw(format!(- "{:width$}",- "Test message",- width = layout.widths.message- ));- data.push_raw(" ");- // State- let states = format_all_states(&info);- data.push_raw(format!("{:width$}", states, width = layout.widths.states));- data.push_raw(" ");- // Path- data.push_raw(shorten_path(&info.worktree.path, &layout.common_prefix));-- // Verify both lines have columns at the same positions- // We'll check this by verifying specific column start positions- let header_str = header.render();- let data_str = data.render();-- // Remove ANSI codes for position checking (our test data doesn't have styles anyway)- assert!(header_str.contains("Branch"));- assert!(data_str.contains("test-branch"));-- // The key test: both lines should have the same visual width up to "Path" column- // (Path is variable width, so we only check up to there)- let header_width_without_path = header.width() - "Path".len();- let data_width_without_path =- data.width() - shorten_path(&info.worktree.path, &layout.common_prefix).len();-- assert_eq!(- header_width_without_path, data_width_without_path,- "Header and data rows should have same width before Path column"- );- }+ // Note: Column alignment is tested via integration tests which capture actual output#[test]fn test_format_diff_column_pads_to_total_width() {diff --git a/src/shell.rs b/src/shell.rsindex fd7fec59b..27a9a1f66 100644--- a/src/shell.rs+++ b/src/shell.rs@@ -263,37 +263,57 @@ impl Shell {/// they automatically get registered for completion - you only need to update the/// completion logic in `src/commands/completion.rs` to define what completions to show.fn generate_fish_dynamic_completions(cli_cmd: &clap::Command, cmd_prefix: &str) -> String {- cli_cmd- .get_subcommands()- .filter_map(|subcmd| {+ fn generate_for_subcommands(+ cmd: &clap::Command,+ cmd_prefix: &str,+ parent_chain: &[&str],+ ) -> Vec<String> {+ let mut completions = Vec::new();++ for subcmd in cmd.get_subcommands() {let name = subcmd.get_name();-- // Skip hidden commands (completion, complete)- if subcmd.is_hide_set() {- return None;- }+ let current_chain: Vec<&str> = parent_chain.iter().copied().chain([name]).collect();// Check if this subcommand has positional argumentslet has_positional = subcmd.get_positionals().next().is_some();- if !has_positional {- return None;++ if has_positional {+ // Generate condition based on command chain+ let condition = if current_chain.len() == 1 {+ // Top-level: just check for the subcommand+ format!("__fish_seen_subcommand_from {}", name)+ } else {+ // Nested: check for parent chain in sequence+ // e.g., for "dev run-hook": "__fish_seen_subcommand_from dev; and __fish_seen_subcommand_from run-hook"+ current_chain+ .iter()+ .map(|part| format!("__fish_seen_subcommand_from {}", part))+ .collect::<Vec<_>>()+ .join("; and ")+ };++ // Get description from the first positional argument's help text+ let desc = subcmd+ .get_positionals()+ .next()+ .and_then(|arg| arg.get_help())+ .map(|h| h.to_string())+ .unwrap_or_else(|| format!("{} argument", current_chain.join(" ")));++ completions.push(format!(+ " complete -c {} -n '{}' -f -a '(__{}_complete)' -d '{}'",+ cmd_prefix, condition, cmd_prefix, desc+ ));}- // Get description from the first positional argument's help text- let desc = subcmd- .get_positionals()- .next()- .and_then(|arg| arg.get_help())- .map(|h| h.to_string())- .unwrap_or_else(|| format!("{} argument", name));-- Some(format!(- " complete -c {} -n '__fish_seen_subcommand_from {}' -f -a '(__{}_complete)' -d '{}'",- cmd_prefix, name, cmd_prefix, desc- ))- })- .collect::<Vec<_>>()- .join("\n")+ // Recurse into nested subcommands+ completions.extend(generate_for_subcommands(subcmd, cmd_prefix, ¤t_chain));+ }++ completions+ }++ generate_for_subcommands(cli_cmd, cmd_prefix, &[]).join("\n")}/// Shell integration configuration@@ -414,6 +434,7 @@ struct XonshTemplate<'a> {#[cfg(test)]mod tests {use super::*;+ use clap::Command;#[test]fn test_shell_from_str() {@@ -423,4 +444,51 @@ mod tests {assert!(matches!("zsh".parse::<Shell>(), Ok(Shell::Zsh)));assert!("invalid".parse::<Shell>().is_err());}++ #[test]+ fn test_fish_dynamic_completions_for_nested_subcommands() {+ // Test that we generate completions for nested subcommands like "dev run-hook"+ let cli = Command::new("test")+ .subcommand(Command::new("parent").subcommand(+ Command::new("nested").arg(clap::Arg::new("hook_type").help("Hook to run")),+ ))+ .subcommand(Command::new("top-level").arg(clap::Arg::new("arg").help("Some arg")));++ let completions = generate_fish_dynamic_completions(&cli, "test");++ // Should include completion for nested command (parent nested)+ assert!(+ completions.contains(+ "__fish_seen_subcommand_from parent; and __fish_seen_subcommand_from nested"+ ),+ "Should generate nested completion for parent nested, got: {}",+ completions+ );++ // Should include completion for top-level command+ assert!(+ completions.contains("__fish_seen_subcommand_from top-level"),+ "Should generate top-level completion, got: {}",+ completions+ );+ }++ #[test]+ fn test_fish_dynamic_completions_deeply_nested() {+ // Test 3-level nesting to verify recursion handles arbitrary depth+ let cli = Command::new("test").subcommand(+ Command::new("a").subcommand(+ Command::new("b")+ .subcommand(Command::new("c").arg(clap::Arg::new("arg").help("deep arg"))),+ ),+ );++ let completions = generate_fish_dynamic_completions(&cli, "test");++ assert!(+ completions.contains("__fish_seen_subcommand_from a; and __fish_seen_subcommand_from b; and __fish_seen_subcommand_from c"),+ "Should handle 3+ level nesting, got: {}",+ completions+ );+ }}diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snapindex 5a619a314..0acac10df 100644--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap@@ -12,11 +12,10 @@ info:GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/nullGIT_CONFIG_SYSTEM: /dev/null- GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpzrEGoe/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjo4ARF/test-config.toml---success: trueexit_code: 0@@ -168,10 +167,13 @@ if type -q wt; or set -q WORKTRUNK_BIN# Register dynamic completionscomplete -c wt -n '__fish_seen_subcommand_from init' -f -a '(__wt_complete)' -d 'Shell to generate code for'+ complete -c wt -n '__fish_seen_subcommand_from dev; and __fish_seen_subcommand_from run-hook' -f -a '(__wt_complete)' -d 'Hook type to run'complete -c wt -n '__fish_seen_subcommand_from switch' -f -a '(__wt_complete)' -d 'Branch name or worktree path'complete -c wt -n '__fish_seen_subcommand_from remove' -f -a '(__wt_complete)' -d 'Worktree names or branches to remove (defaults to current worktree if none specified)'complete -c wt -n '__fish_seen_subcommand_from push' -f -a '(__wt_complete)' -d 'Target branch (defaults to default branch)'complete -c wt -n '__fish_seen_subcommand_from merge' -f -a '(__wt_complete)' -d 'Target branch to merge into (defaults to default branch)'+ complete -c wt -n '__fish_seen_subcommand_from completion' -f -a '(__wt_complete)' -d 'Shell to generate completions for'+ complete -c wt -n '__fish_seen_subcommand_from complete' -f -a '(__wt_complete)' -d 'Arguments to complete'end# Static completions (commands and flags)diff --git a/tests/snapshots/integration__integration_tests__list__detached_head.snap b/tests/snapshots/integration__integration_tests__list__detached_head.snapindex 7b5e713b1..b6502f461 100644--- a/tests/snapshots/integration__integration_tests__list__detached_head.snap+++ b/tests/snapshots/integration__integration_tests__list__detached_head.snap@@ -15,13 +15,13 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfBULGg/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpxm1rxH/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35m(detached)[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m.[0m+[2mBranch [0m [2mPath[0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35m(detached)[0m [1m[35m.[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 1 worktree[0mdiff --git a/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap b/tests/snapshots/integration__integration_tests__list__locked_no_reason.snapindex ea7b89609..3fb46ca7e 100644--- a/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap+++ b/tests/snapshots/integration__integration_tests__list__locked_no_reason.snap@@ -15,14 +15,14 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpPw5Q3N/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkBJ5eI/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mState [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-locked-no-reason [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m (locked) ./locked-no-reason+[2mBranch [0m [2mState [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+locked-no-reason (locked) ./locked-no-reason [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 2 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__list__locked_worktree.snap b/tests/snapshots/integration__integration_tests__list__locked_worktree.snapindex 0b6cd9da2..e4ac5bf38 100644--- a/tests/snapshots/integration__integration_tests__list__locked_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__locked_worktree.snap@@ -15,14 +15,14 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpilr8FV/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmppF4TvD/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mState [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-locked-feature [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m (locked: Testing lock functionality) ./locked-feature+[2mBranch [0m [2mState [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+locked-feature (locked: Testing lock functionality) ./locked-feature [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 2 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__list__long_commit_message.snap b/tests/snapshots/integration__integration_tests__list__long_commit_message.snapindex 9e85073d7..e624d5b8d 100644--- a/tests/snapshots/integration__integration_tests__list__long_commit_message.snap+++ b/tests/snapshots/integration__integration_tests__list__long_commit_message.snap@@ -15,14 +15,14 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5QSYCO/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkjqAKW/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCmts [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2m1310bfb9[0m [2mShort message[0m [1m[35m./test-repo[0m-feature-a [2m10 months ago[0m [33m↑0 ↓1[0m [2mf078644e[0m [2mThis is a very long commit message that should...[0m ./feature-a+[2mBranch [0m [2mCmts [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2m1310bfb9[0m [2mShort message[0m+feature-a [33m↑0 ↓1[0m ./feature-a [2m10 months ago[0m [2mf078644e[0m [2mThis is a very long commit message that should test how the message column handles...[0m[2mShowing 2 worktrees, 1 behind[0mdiff --git a/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap b/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snapindex 6acd57893..3cdf8f944 100644--- a/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap+++ b/tests/snapshots/integration__integration_tests__list__many_worktrees_varied.snap@@ -15,17 +15,17 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp57rBrF/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpNoMoVr/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-medium-name [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./medium-name-short [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./short-very-long-branch-name-here [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./very-long-branch-name-here-with-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./with-changes+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+medium-name ./medium-name [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+short ./short [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+very-long-branch-name-here ./very-long-branch-name-here [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+with-changes ./with-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 5 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snapindex 70cbb30b8..80dc7b12f 100644--- a/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap+++ b/tests/snapshots/integration__integration_tests__list__multiple_worktrees.snap@@ -15,15 +15,15 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpF3BHBv/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpSNzXtm/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-feature-a [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-a-feature-b [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-b+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-a ./feature-a [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-b ./feature-b [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 3 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__list__single_worktree.snap b/tests/snapshots/integration__integration_tests__list__single_worktree.snapindex ace1b2b60..9c6655f06 100644--- a/tests/snapshots/integration__integration_tests__list__single_worktree.snap+++ b/tests/snapshots/integration__integration_tests__list__single_worktree.snap@@ -15,13 +15,13 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXvtpOP/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDtYgxP/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch[0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m.[0m+[2mBranch[0m [2mPath[0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m.[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 1 worktree[0mdiff --git a/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap b/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snapindex d2b061f4e..7e8d720f2 100644--- a/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap+++ b/tests/snapshots/integration__integration_tests__list__unicode_commit_message.snap@@ -15,14 +15,14 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpTb7dXk/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpav4jPx/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCmts [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2me4614cb7[0m [2mFix bug with café ☕ handling[0m [1m[35m./test-repo[0m-feature-test [2m10 months ago[0m [33m↑0 ↓1[0m [2m0c53695b[0m [2mAdd support for 日本語 and...[0m ./feature-test+[2mBranch [0m [2mCmts [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2me4614cb7[0m [2mFix bug with café ☕ handling[0m+feature-test [33m↑0 ↓1[0m ./feature-test [2m10 months ago[0m [2m0c53695b[0m [2mAdd support for 日本語 and émoji 🎉[0m[2mShowing 2 worktrees, 1 behind[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag.snapindex 4e111b0e3..2b15d17ea 100644--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap@@ -16,17 +16,17 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp7sIyMZ/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpG8kNFZ/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-feature-with-worktree [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-with-worktree-another-branch [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m-feature-without-worktree [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m-fix-bug [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-with-worktree ./feature-with-worktree [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+another-branch [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-without-worktree [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+fix-bug [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 2 worktrees, 3 branches[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snapindex 9c2cf9cdd..a5883deee 100644--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag_none_available.snap@@ -16,15 +16,15 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmphPAgwk/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpoOmhpq/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-feature-a [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-a-feature-b [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-b+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-a ./feature-a [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-b ./feature-b [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 3 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snapindex 340385fb3..0d51271c4 100644--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap@@ -16,16 +16,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcu13Lb/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp1lpiaf/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m.[0m-branch-alpha [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m-branch-beta [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m-branch-gamma [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+[2mBranch [0m [2mPath[0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m.[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+branch-alpha [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+branch-beta [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+branch-gamma [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 1 worktrees, 3 branches[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snapindex d0c1d82fa..6469cd5af 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_empty_diffs.snap@@ -15,16 +15,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpGSIXL4/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpssSPOb/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mWT +/-[0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-also-no-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./also-no-changes-no-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./no-changes-with-changes [2m10 months ago[0m [32m+1[0m [31m-1[0m [2mb834638e[0m [2mInitial commit[0m ./with-changes+[2mBranch [0m [2mWT +/-[0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+also-no-changes ./also-no-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+no-changes ./no-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+with-changes [32m+1[0m [31m-1[0m ./with-changes [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 4 worktrees, 1 with changes[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snapindex 923cf3adc..2b9f5ce46 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap@@ -15,15 +15,15 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpYfRjbN/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLO8yce/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch[0m [2mAge [0m [2mWT +/-[0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-huge [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./huge-tiny [2m10 months ago[0m [32m+1[0m [31m-1[0m [2mb834638e[0m [2mInitial commit[0m ./tiny+[2mBranch[0m [2mWT +/-[0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+huge ./huge [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+tiny [32m+1[0m [31m-1[0m ./tiny [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 3 worktrees, 1 with changes[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snapindex bf9f3b117..93e1baf50 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap@@ -15,16 +15,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmplxKChq/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpl2ecpl/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-feature-large [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-large-feature-medium [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-medium-feature-small [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./feature-small+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-large ./feature-large [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-medium ./feature-medium [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+feature-small ./feature-small [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 4 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snapindex c76001c19..afeb2d889 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__long_branch_names.snap@@ -15,16 +15,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpwvBiav/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmps9ToYO/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-another-extremely-long-name-here [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./another-extremely-long-name-here-short [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./short-very-long-feature-branch-name [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./very-long-feature-branch-name+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+another-extremely-long-name-here ./another-extremely-long-name-here [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+short ./short [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+very-long-feature-branch-name ./very-long-feature-branch-name [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 4 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snapindex 0db560194..8ac92e532 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__mixed_length_branch_names.snap@@ -15,16 +15,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjsxP59/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpihJu55/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch[0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-long [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./extremely-long-branch-name-that-might-cause-layout-issues-medium [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./medium-length-name-x [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./x+[2mBranch[0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+long ./extremely-long-branch-name-that-might-cause-layout-issues [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+medium ./medium-length-name [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+x ./x [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 4 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snapindex a55b99844..5689aabd8 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__short_branch_names.snap@@ -15,16 +15,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpI8zC5b/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpEeVOyn/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch[0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-a [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./a-bb [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./bb-ccc [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./ccc+[2mBranch[0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+a ./a [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+bb ./bb [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+ccc ./ccc [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 4 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_120.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_120.snapindex 071cc961a..57013f751 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_120.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_120.snap@@ -15,15 +15,15 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpD3scqm/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp98HOEI/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m [1m[35m./test-repo[0m-feature-a [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m ./feature-a-feature-b [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m ./feature-b+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m+feature-a ./feature-a [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m+feature-b ./feature-b [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m[2mShowing 3 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_150.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_150.snapindex f657bb099..9b052f6b4 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_150.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_150.snap@@ -15,15 +15,15 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpGaBRvL/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5pVEDf/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m [1m[35m./test-repo[0m-feature-a [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m ./feature-a-feature-b [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m ./feature-b+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m+feature-a ./feature-a [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m+feature-b ./feature-b [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a reasonably long message[0m[2mShowing 3 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_80.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_80.snapindex 03b1e0b67..599d745ef 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_80.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__terminal_width_80.snap@@ -15,15 +15,15 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjK3f7K/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpvXdvGk/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch [0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a...[0m [1m[35m./test-repo[0m-feature-a [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a...[0m ./feature-a-feature-b [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a...[0m ./feature-b+[2mBranch [0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a...[0m+feature-a ./feature-a [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a...[0m+feature-b ./feature-b [2m10 months ago[0m [2ma7bc47ca[0m [2mInitial commit with a...[0m[2mShowing 3 worktrees[0mdiff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snapindex b206a8d09..86a7694a4 100644--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snap+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__unicode_branch_names.snap@@ -15,16 +15,16 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpPtgOB7/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpdHGY68/test-config.toml---success: trueexit_code: 0----- stdout ------[2mBranch[0m [2mAge [0m [2mCommit [0m [2mMessage [0m [2mPath[0m-[1m[35mmain [0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m [1m[35m./test-repo[0m-cafe [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./café-naive [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./naïve-resume [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m ./résumé+[2mBranch[0m [2mPath [0m [2mAge [0m [2mCommit [0m [2mMessage [0m+[1m[35mmain [0m [1m[35m./test-repo[0m [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+cafe ./café [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+naive ./naïve [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m+resume ./résumé [2m10 months ago[0m [2mb834638e[0m [2mInitial commit[0m[2mShowing 4 worktrees[0m