fix(cli): make --check a consistent exit-code gate across commands - #404
Merged
Conversation
status --check and clean --check gate the exit code and leave output alone. doctor --check did the opposite: it suppressed the report but returned an error with or without the flag, so it was not a gate at all and its own flag help was wrong. doctor now always prints its report and only fails when --check is passed. Without --check it is a diagnostic that exits 0, which keeps it usable mid-pipeline and is what makes --check meaningful. BREAKING: "grut doctor" alone no longer exits non-zero on a failed required check. Add --check to restore the gate behavior. Also reject unknown names in "theme show". theme.Load falls back to the default theme so a stale config value cannot stop the TUI from launching, but that made "grut theme show grubvox" print the default theme and exit 0, silently hiding the typo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c5a9c45a-0341-46e5-8458-f4060ddd58c7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on the release MQ pass.
status --checkandclean --checkgate the exit code and leave output alone.doctor --checkdid the opposite: it suppressed the report but returned an error with or without the flag, so it was never a gate, and its own flag help said otherwise.Changes
doctoralways prints its report now, and only fails when--checkis passedtheme show <unknown>errors instead of silently printing the default themeBreaking
grut doctoralone no longer exits non-zero on a failed required check. Add--checkto restore the gate. Without the flag it is a diagnostic that exits 0, which keeps it usable mid-pipeline and is what makes--checkmeaningful in the first place.theme show
theme.Loadfalls back to the default theme for an unknown name so a stale config value can't stop the TUI from launching. That's right for the TUI and wrong forshow, wheregrut theme show grubvoxprinted the default theme and exited 0, hiding the typo. Validation happens againstListThemes()(built-in plus custom) beforeLoadis called.Testing
go test ./cmd/...passes. Three tests that encoded the old doctor contract were updated, and new coverage asserts the unknown-theme rejection short-circuits beforeloadruns.