summaryrefslogtreecommitdiff
path: root/cmd/krino/sort.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/sort.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/sort.go')
-rw-r--r--cmd/krino/sort.go16
1 files changed, 9 insertions, 7 deletions
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)
+ }
}
}