Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix: move fish shell integration to functions/ for Homebrew compatibility (#586)
Maximilian Roose4bb2c898bfb
diff --git a/src/commands/config.rs b/src/commands/config.rsindex 8b808322b..b35256e42 100644--- a/src/commands/config.rs+++ b/src/commands/config.rs@@ -516,7 +516,6 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {});let mut any_not_configured = false;- let mut not_configured_shells: Vec<Shell> = Vec::new();let mut has_any_unmatched = false;// Show configured and not-configured shells (matching `config shell install` format exactly)@@ -539,14 +538,13 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {.iter().find(|d| d.path == result.path && !d.matched_lines.is_empty());- // Build file:line location (clickable in terminals)+ // Build file:line location (clickable in terminals - use first line only)let location = if let Some(det) = detection {- let line_nums: Vec<_> = det- .matched_lines- .iter()- .map(|d| d.line_number.to_string())- .collect();- format!("{}:{}", path, line_nums.join(","))+ if let Some(first_line) = det.matched_lines.first() {+ format!("{}:{}", path, first_line.line_number)+ } else {+ path.to_string()+ }} else {path.to_string()};@@ -608,9 +606,6 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {)?;} else {any_not_configured = true;- if !not_configured_shells.contains(&shell) {- not_configured_shells.push(shell);- }writeln!(out,"{}",@@ -650,9 +645,6 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {)?;} else {any_not_configured = true;- if !not_configured_shells.contains(&shell) {- not_configured_shells.push(shell);- }writeln!(out,"{}",@@ -703,11 +695,9 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {)?;}- // Summary hint - be specific about which shells need configuration- if any_not_configured && !not_configured_shells.is_empty() {+ // Summary hint when shells need configuration+ if any_not_configured {writeln!(out)?;- // CLI accepts one shell at a time, so suggest the base command- // which auto-detects and configures all available shellswriteln!(out,"{}",@@ -725,13 +715,12 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {has_any_unmatched = true;let path = format_path_for_display(&detection.path);- // Build file:line location (clickable in terminals)- let line_nums: Vec<_> = detection- .unmatched_candidates- .iter()- .map(|d| d.line_number.to_string())- .collect();- let location = format!("{}:{}", path, line_nums.join(","));+ // Build file:line location (clickable in terminals - use first line only)+ let location = if let Some(first) = detection.unmatched_candidates.first() {+ format!("{}:{}", path, first.line_number)+ } else {+ path.to_string()+ };writeln!(out,"{}",diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rsindex 25aa8ece1..a555420ef 100644--- a/src/commands/configure_shell.rs+++ b/src/commands/configure_shell.rs@@ -109,8 +109,11 @@ impl ConfigAction {}/// Check if file content appears to be worktrunk-managed (contains our markers)+///+/// Used to identify files safe to delete during migration/uninstall.+/// Requires both the init command AND pipe to source, to avoid false positives.fn is_worktrunk_managed_content(content: &str, cmd: &str) -> bool {- content.contains(&format!("{cmd} config shell init"))+ content.contains(&format!("{cmd} config shell init")) && content.contains("| source")}/// Clean up legacy fish conf.d file after installing to functions/@@ -545,11 +548,16 @@ fn configure_fish_file(}if dry_run {- // Fish always writes the complete file (doesn't append), so always WouldCreate+ // Fish writes the complete file - use WouldAdd if file exists, WouldCreate if new+ let action = if path.exists() {+ ConfigAction::WouldAdd+ } else {+ ConfigAction::WouldCreate+ };return Ok(Some(ConfigureResult {shell,path: path.to_path_buf(),- action: ConfigAction::WouldCreate,+ action,config_line: config_line.to_string(),}));}diff --git a/src/shell.rs b/src/shell.rsindex d3723355a..b811f6db0 100644--- a/src/shell.rs+++ b/src/shell.rs@@ -668,7 +668,8 @@ impl ShellInit {/// Generate fish wrapper code (for `wt config shell install fish`)////// This generates a minimal wrapper that sources the full function from the binary.- /// Unlike `generate()` which outputs the full function, this wrapper auto-updates.+ /// The wrapper file itself is static, but it loads the init output at runtime,+ /// so users get updated behavior without reinstalling.pub fn generate_fish_wrapper(&self) -> Result<String, askama::Error> {let template = FishWrapperTemplate { cmd: &self.cmd };template.render()