Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Remove expand_command_template function
Maximilian Roos53a344e49f21
diff --git a/src/config/expansion.rs b/src/config/expansion.rsindex cba7eb34e..088a87806 100644--- a/src/config/expansion.rs+++ b/src/config/expansion.rs@@ -88,59 +88,3 @@ pub fn expand_template(tmpl.render(minijinja::Value::from_object(context)).map_err(|e| format!("Template render error: {}", e))}--/// Expand command template variables using minijinja-///-/// Convenience function for expanding command templates with common variables.-/// Shell-escapes all values for safe command execution.-///-/// Supported variables:-/// - `{{ repo }}` - Repository name-/// - `{{ branch }}` - Branch name (sanitized: slashes → dashes)-/// - `{{ worktree }}` - Absolute path to the worktree-/// - `{{ worktree_name }}` - Worktree directory name (basename of worktree path)-/// - `{{ repo_root }}` - Absolute path to the main repository root-/// - `{{ default_branch }}` - Default branch name (e.g., "main")-/// - `{{ commit }}` - Current HEAD commit SHA (full 40-character hash)-/// - `{{ short_commit }}` - Current HEAD commit SHA (short 7-character hash)-/// - `{{ remote }}` - Primary remote name (e.g., "origin")-/// - `{{ upstream }}` - Upstream tracking branch (e.g., "origin/feature"), if configured-/// - `{{ target }}` - Target branch (for merge commands, optional)-///-/// # Examples-/// ```-/// use worktrunk::config::expand_command_template;-/// use std::path::Path;-///-/// let cmd = expand_command_template(-/// "cp {{ repo_root }}/target {{ worktree }}/target",-/// "myrepo",-/// "feature",-/// Path::new("/path/to/worktree"),-/// Path::new("/path/to/repo"),-/// None,-/// ).unwrap();-/// ```-pub fn expand_command_template(- command: &str,- repo_name: &str,- branch: &str,- worktree_path: &std::path::Path,- repo_root: &std::path::Path,- target_branch: Option<&str>,-) -> Result<String, String> {- let safe_branch = sanitize_branch_name(branch);- let worktree_str = worktree_path.to_string_lossy();- let repo_root_str = repo_root.to_string_lossy();-- let mut vars = HashMap::new();- vars.insert("repo", repo_name);- vars.insert("branch", safe_branch.as_str());- vars.insert("worktree", worktree_str.as_ref());- vars.insert("repo_root", repo_root_str.as_ref());- if let Some(target) = target_branch {- vars.insert("target", target);- }-- expand_template(command, &vars, true)-}diff --git a/src/config/mod.rs b/src/config/mod.rsindex c6371d931..36a9999d2 100644--- a/src/config/mod.rs+++ b/src/config/mod.rs@@ -45,7 +45,7 @@ mod user;// Re-export public typespub use commands::{Command, CommandConfig, CommandPhase};-pub use expansion::{expand_command_template, expand_template, sanitize_branch_name};+pub use expansion::{expand_template, sanitize_branch_name};pub use project::{ProjectConfig, find_unknown_keys as find_unknown_project_keys};pub use user::{CommitGenerationConfig, StageMode, UserProjectConfig, WorktrunkConfig,