diff options
Diffstat (limited to 'gui/internal/model/plan.go')
| -rw-r--r-- | gui/internal/model/plan.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gui/internal/model/plan.go b/gui/internal/model/plan.go index 86acab7..6d3e857 100644 --- a/gui/internal/model/plan.go +++ b/gui/internal/model/plan.go @@ -219,6 +219,25 @@ func (t *PlanTab) Replace(i int, kind plan.Kind) error { return fmt.Errorf("model: %s is not in this plan", rel) } +// ReplaceSelected swaps the steps of every checked file for the one action +// chosen - "Trash the checked files", "Delete them permanently" - and +// reports how many were changed. Nothing happens on disk: like every other +// review decision, it changes the plan, and Apply carries it out (his +// request, 2026-09-17). +func (t *PlanTab) ReplaceSelected(kind plan.Kind) (int, error) { + n := 0 + for i, r := range t.Rows { + if !r.Selected { + continue + } + if err := t.Replace(i, kind); err != nil { + return n, err + } + n++ + } + return n, nil +} + // Apply acts on the selected files and logs the rest as declined, exactly // as choosing per file in the terminal does. Each row then carries its // outcome. |
