aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/krino/explain.go3
-rw-r--r--cmd/krino/sort_test.go6
2 files changed, 9 insertions, 0 deletions
diff --git a/cmd/krino/explain.go b/cmd/krino/explain.go
index 5f9f6de..f65df42 100644
--- a/cmd/krino/explain.go
+++ b/cmd/krino/explain.go
@@ -78,6 +78,9 @@ func cmdExplain(g *globals, args []string, stdout, stderr io.Writer) int {
fmt.Fprintf(stdout, "rule %s: %s\n", rt.Rule.Name, status)
printTrace(stdout, rt.Trace)
}
+ if x.NoDelete != "" {
+ fmt.Fprintf(stdout, "\nkrino would skip deleting this file: %s\n", display(x.NoDelete))
+ }
return 0
}
diff --git a/cmd/krino/sort_test.go b/cmd/krino/sort_test.go
index 321c9e8..12edb24 100644
--- a/cmd/krino/sort_test.go
+++ b/cmd/krino/sort_test.go
@@ -225,4 +225,10 @@ func TestDryRunShowsNeverDeletedSkip(t *testing.T) {
if !strings.Contains(out, "skipped: a duplicate is never deleted") {
t.Errorf("plan lacks the skipped delete:\n%s", out)
}
+ // explain shows it too, for the copy that is the duplicate (triage 30a).
+ _, outA, _ := runCLI(t, "explain", filepath.Join(dl, "a.pdf"))
+ _, outB, _ := runCLI(t, "explain", filepath.Join(dl, "b.pdf"))
+ if strings.Count(outA+outB, "a duplicate is never deleted") != 1 {
+ t.Errorf("explain should name the skipped delete for exactly one copy:\n%s\n%s", outA, outB)
+ }
}