diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 16:48:53 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 16:48:53 +0200 |
| commit | e64f162bffa6ced845bac4d3015954c41c4b4a3e (patch) | |
| tree | 87b8fb52b476644ec99cd091bb34ac6521ae9b33 /cmd/krino/sort.go | |
| parent | 0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe (diff) | |
| download | krino-0.0.6.tar.gz krino-0.0.6.zip | |
krino: 0.0.6 — w applies and quits, choices echoed in redv0.0.6
Diffstat (limited to 'cmd/krino/sort.go')
| -rw-r--r-- | cmd/krino/sort.go | 15 |
1 files changed, 12 insertions, 3 deletions
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 { |
