summaryrefslogtreecommitdiff
path: root/cmd/krino/undo.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 13:26:51 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 13:26:51 +0200
commit07c24054cab965800983ef40f53a05c2db131ede (patch)
tree741db561d614b35f8f94fee04fb5ce663a629a0b /cmd/krino/undo.go
parent70dccf8d573028aaed64185acb8e134e5339afa3 (diff)
downloadkrino-0.0.3.tar.gz
krino-0.0.3.zip
krino: 0.0.3 — the plan as one block per file, wrapped, and -Pv0.0.3
Each file shows its steps, then the rule and the reason it matched, one field per line; on a terminal every line wraps to its width with continuation lines under their own column, and piped output is never wrapped. Choosing per file shows the same block. -P / --no-pager prints the plan without the pager. A duplicate's original is shown with ~.
Diffstat (limited to 'cmd/krino/undo.go')
-rw-r--r--cmd/krino/undo.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/krino/undo.go b/cmd/krino/undo.go
index cc65eea..d31a5b3 100644
--- a/cmd/krino/undo.go
+++ b/cmd/krino/undo.go
@@ -19,7 +19,6 @@ import (
"krino/internal/engine"
"krino/internal/journal"
"krino/internal/lock"
- "krino/internal/tui"
"krino/internal/xdg"
)
@@ -147,7 +146,7 @@ func cmdUndo(g *globals, args []string, stdout, stderr io.Writer) int {
text := colourRefused(buf.String(), p)
// Ruling 6 (Task 7), carried over: the plan goes through tui.Page for
// -n as much as for -y and the interactive path.
- if err := tui.Page(stdout, text); err != nil {
+ if err := show(g, stdout, text); err != nil {
fmt.Fprintf(stderr, "krino: %v\n", err)
return 1
}
@@ -334,7 +333,10 @@ func reviewUndoDir(out io.Writer, files []engine.UndoFile, p palette) (map[int]b
// folding rule reviewChains uses: a [c] session's own [q] becomes the same
// top-level 'q', and approved is emptied to match.
func reviewUndoFiles(in io.Reader, out io.Writer, files []engine.UndoFile, p palette) (map[int]bool, rune, error) {
- fmt.Fprint(out, "\n"+p.keys("[a] apply all [c] choose per file [s] skip [q] quit")+"\n")
+ fmt.Fprintln(out)
+ for _, l := range wrapped("", "[a] apply all [c] choose per file [s] skip [q] quit", 0, widthPolicy(out), p.keys) {
+ fmt.Fprintln(out, l)
+ }
for {
key, err := readKey(in)
if err != nil {
@@ -384,7 +386,9 @@ func reviewUndoPerFile(in io.Reader, out io.Writer, files []engine.UndoFile, p p
continue
}
- fmt.Fprint(out, " "+p.keys("[y] yes [n] no [a] yes to this and all remaining [d] done, apply chosen so far [q] quit, apply nothing")+"\n")
+ for _, l := range wrapped(" ", perFileKeys, 2, widthPolicy(out), p.keys) {
+ fmt.Fprintln(out, l)
+ }
for {
key, kerr := readKey(in)
if kerr != nil {