From 07c24054cab965800983ef40f53a05c2db131ede Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 13:26:51 +0200 Subject: krino: 0.0.3 — the plan as one block per file, wrapped, and -P MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ~. --- cmd/krino/undo.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cmd/krino/undo.go') 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 { -- cgit v1.3