From e64f162bffa6ced845bac4d3015954c41c4b4a3e Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 16:48:53 +0200 Subject: krino: 0.0.6 — w applies and quits, choices echoed in red MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/krino/sort.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'cmd/krino/sort.go') diff --git a/cmd/krino/sort.go b/cmd/krino/sort.go index 3e5d951..04fd3e8 100644 --- a/cmd/krino/sort.go +++ b/cmd/krino/sort.go @@ -247,7 +247,16 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int { // [t] and [d] in review: the file gets the one step chosen // there instead of the chain its rules planned. dp.Chains = replaceChains(dp.Chains, replaced) - res, aerr := e.Apply(ctx, dp, approved, j, run) + // [w]: apply what was decided, log nothing for the files never + // reached, and stop krino once this directory is applied. + toApply, notReviewed := dp, 0 + if action == 'w' { + reviewed := *dp + reviewed.Chains = reviewedChains(dp.Chains, approved) + toApply = &reviewed + notReviewed = len(actionable) - len(reviewedChains(actionable, approved)) + } + res, aerr := e.Apply(ctx, toApply, approved, j, run) if aerr != nil { if errors.Is(aerr, context.Canceled) || errors.Is(aerr, context.DeadlineExceeded) { // Interrupted mid-apply (fix round 2026-09-12/item 2): @@ -263,13 +272,13 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int { exit = 1 return false } - fmt.Fprintln(stdout, outcome(p, res.Applied, res.Failed, res.Declined)) + fmt.Fprintln(stdout, withNotReviewed(outcome(p, res.Applied, res.Failed, res.Declined), notReviewed)) // Ruling 1: only an actual step failure makes the run exit 1 // here - a directory the user declined or skipped must not. if res.Failed > 0 { exit = 1 } - return false + return action == 'w' }() if quit { -- cgit v1.3