aboutsummaryrefslogtreecommitdiff
path: root/gui/internal/model/plan.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 00:51:15 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 00:51:15 +0200
commit5418ba6bc5c653b6a99572c6ece6abbf57836c43 (patch)
treeae0a430c468890770d20f531c3a026937c9bb948 /gui/internal/model/plan.go
parentca0b703526151149d060d6d38f307e9e38c3dcd2 (diff)
downloadkrino-5418ba6bc5c653b6a99572c6ece6abbf57836c43.tar.gz
krino-5418ba6bc5c653b6a99572c6ece6abbf57836c43.zip
gui: coloured actions with headers, a filter over the plan, bulk trash or delete
Diffstat (limited to 'gui/internal/model/plan.go')
-rw-r--r--gui/internal/model/plan.go19
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.