diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 14:08:36 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 14:08:36 +0200 |
| commit | 1d3f2d1e4c59867024470d3444e12698b7ebb22e (patch) | |
| tree | 4fa14f455c72f9b206a680dcc1b0f4c1f3708158 /cmd/krino/render.go | |
| parent | 07c24054cab965800983ef40f53a05c2db131ede (diff) | |
| download | krino-1d3f2d1e4c59867024470d3444e12698b7ebb22e.tar.gz krino-1d3f2d1e4c59867024470d3444e12698b7ebb22e.zip | |
0.0.4: max-size, exclude forms, --min-agev0.0.4
Diffstat (limited to 'cmd/krino/render.go')
| -rw-r--r-- | cmd/krino/render.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cmd/krino/render.go b/cmd/krino/render.go index 8031767..f94b15a 100644 --- a/cmd/krino/render.go +++ b/cmd/krino/render.go @@ -67,6 +67,13 @@ func printPlan(w io.Writer, dp *engine.DirPlan, verbose bool, p palette, width i } if verbose { + if lines := excludedLines(r, dp.Chains); len(lines) > 0 { + fmt.Fprintln(w) + fmt.Fprintln(w, "excluded") + for _, l := range lines { + fmt.Fprintln(w, l) + } + } if len(r.Unmatched) > 0 { fmt.Fprintln(w) fmt.Fprintln(w, "not matched") @@ -82,6 +89,36 @@ func printPlan(w io.Writer, dp *engine.DirPlan, verbose bool, p palette, width i } } +// excludedLines lists, for -v, every file that was set aside: each chain +// with no steps, with what set it aside - the (exclude ...) form, or the +// action-less rule it matched. Names are padded to the widest shown +// (capped at 40), as in the warnings section. +func excludedLines(r *engine.Result, chains []plan.Chain) []string { + byRel := make(map[string]engine.FileMatch, len(r.Matched)) + for _, fm := range r.Matched { + byRel[fm.File.Rel] = fm + } + var rels, why []string + for _, c := range chains { + if len(c.Steps) > 0 { + continue + } + fm := byRel[c.File.Rel] + reason := fm.Excluded + 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) + } + width := relWidth(rels) + out := make([]string, len(rels)) + for i := range rels { + out[i] = " " + padCell(rels[i], width) + " " + why[i] + } + return out +} + // chainActing reports whether c has at least one step that will actually // run - the single definition of "actionable" that countActing, // actionableChains (sort.go) and chainOutcomes (sort.go) all share (fix |
