summaryrefslogtreecommitdiff
path: root/cmd/krino/sort.go
diff options
context:
space:
mode:
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)
+ }
}
}