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/sort.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'cmd/krino/sort.go') diff --git a/cmd/krino/sort.go b/cmd/krino/sort.go index dd056e0..6d11238 100644 --- a/cmd/krino/sort.go +++ b/cmd/krino/sort.go @@ -23,7 +23,6 @@ import ( "krino/internal/lock" "krino/internal/plan" "krino/internal/scan" - "krino/internal/tui" "krino/internal/xdg" ) @@ -187,8 +186,8 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int { // exists for. printPlan is reused as-is (render.go), never // re-rendered here. var buf bytes.Buffer - printPlan(&buf, dp, g.verbose, p) - if err := tui.Page(stdout, buf.String()); err != nil { + printPlan(&buf, dp, g.verbose, p, widthPolicy(stdout)) + if err := show(g, stdout, buf.String()); err != nil { fmt.Fprintf(stderr, "krino: %s: %v\n", d.Name, err) exit = 1 return false @@ -432,15 +431,18 @@ func warnedCount(lines []warnLine) int { } // printWarnings lists one line per warning, Rel padded to the widest shown -// (capped at 40), each line styled with p's warning colour. -func printWarnings(w io.Writer, lines []warnLine, p palette) { +// (capped at 40), each line styled with p's warning colour. width wraps a +// long line with its continuation indented four columns (0 never wraps). +func printWarnings(w io.Writer, lines []warnLine, p palette, width int) { rels := make([]string, len(lines)) for i, l := range lines { rels[i] = l.rel } - width := relWidth(rels) + relW := relWidth(rels) for _, l := range lines { - fmt.Fprintf(w, " %s\n", p.warn(padCell(l.rel, width)+" "+l.text)) + for _, piece := range wrapped(" ", padCell(l.rel, relW)+" "+l.text, 4, width, p.warn) { + fmt.Fprintln(w, piece) + } } } -- cgit v1.3