aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/render.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 20:11:26 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 20:11:26 +0200
commit97b07968a0a239c862309bcdffe31848dfbf128c (patch)
treeb662f247c33ea93c0544dc8be40250dcf2a62fc7 /cmd/krino/render.go
parentaa24cfb344b1b3eaef7217d996359023cd72ba28 (diff)
downloadkrino-97b07968a0a239c862309bcdffe31848dfbf128c.tar.gz
krino-97b07968a0a239c862309bcdffe31848dfbf128c.zip
plan 8: escape terminal controls in everything krino prints
Diffstat (limited to 'cmd/krino/render.go')
-rw-r--r--cmd/krino/render.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/krino/render.go b/cmd/krino/render.go
index f94b15a..50e52b0 100644
--- a/cmd/krino/render.go
+++ b/cmd/krino/render.go
@@ -78,7 +78,7 @@ func printPlan(w io.Writer, dp *engine.DirPlan, verbose bool, p palette, width i
fmt.Fprintln(w)
fmt.Fprintln(w, "not matched")
for _, fm := range r.Unmatched {
- fmt.Fprintf(w, " %s\n", fm.File.Rel)
+ fmt.Fprintf(w, " %s\n", display(fm.File.Rel))
}
}
if len(r.Skipped) > 0 {
@@ -108,8 +108,8 @@ func excludedLines(r *engine.Result, chains []plan.Chain) []string {
if reason == "" && len(fm.Rules) > 0 {
reason = "rule " + fm.Rules[len(fm.Rules)-1].Rule.Name
}
- rels = append(rels, c.File.Rel)
- why = append(why, reason)
+ rels = append(rels, display(c.File.Rel))
+ why = append(why, display(reason))
}
width := relWidth(rels)
out := make([]string, len(rels))
@@ -175,7 +175,7 @@ func printBlocks(w io.Writer, chains []plan.Chain, root string, p palette, width
i++
fmt.Fprintln(w)
head := " " + padLeft(strconv.Itoa(i), numW) + " "
- for _, l := range wrapped(head, c.File.Rel, indent, width, plainText) {
+ for _, l := range wrapped(head, display(c.File.Rel), indent, width, plainText) {
fmt.Fprintln(w, l)
}
for _, l := range stepLines(c, indent, root, p, width) {
@@ -201,9 +201,9 @@ func stepLines(c plan.Chain, indent int, root string, p palette, width int) []st
if i+1 < len(c.Steps) && c.Steps[i+1].Rule == s.Rule {
continue
}
- out = append(out, field(indent, "rule", s.Rule, width, plainText, p.rule)...)
+ out = append(out, field(indent, "rule", display(s.Rule), width, plainText, p.rule)...)
if s.Reason != "" && s.Reason != "no condition" {
- out = append(out, field(indent, "because", s.Reason, width, plainText, p.faint)...)
+ out = append(out, field(indent, "because", display(s.Reason), width, plainText, p.faint)...)
}
}
return out
@@ -215,13 +215,13 @@ func stepLines(c plan.Chain, indent int, root string, p palette, width int) []st
// note when the step replaces an existing file.
func stepValue(s plan.Step, root string) string {
if s.Skip != "" {
- return "skipped: " + s.Skip
+ return "skipped: " + display(s.Skip)
}
switch s.Kind {
case plan.Trash, plan.DeletePermanent:
return ""
}
- v := "→ " + destText(s, root)
+ v := "→ " + display(destText(s, root))
if s.Displaces != "" {
v += " (replaces the existing file)"
}