Skip to main content

format_remove_plan

Function format_remove_plan 

Source
pub fn format_remove_plan(
    name: &str,
    path: &Path,
    branch: Option<&str>,
    delete_branch: bool,
) -> String
Expand description

Render the would-do plan for gwm remove --dry-run (issue #31). Extracted from cmd_remove so the formatter is unit-testable without spinning up a real worktree. Pure function: takes the resolved name + path + branch, returns a multi-line string (trailing newline included).

delete_branch only adds “(would be deleted)” when there is a branch to delete — a detached HEAD worktree with --delete-branch reports “(no branch to delete)” instead, mirror- ing worktree::remove’s actual behaviour (it only drops a branch when one is resolvable).