Skip to content

fix(cli): make --check a consistent exit-code gate across commands - #404

Merged
jongio merged 1 commit into
mainfrom
fix/cli-check-conventions
Aug 5, 2026
Merged

fix(cli): make --check a consistent exit-code gate across commands#404
jongio merged 1 commit into
mainfrom
fix/cli-check-conventions

Conversation

@jongio

@jongio jongio commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Follows up on the release MQ pass. 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 never a gate, and its own flag help said otherwise.

Changes

  • doctor always prints its report now, and only fails when --check is passed
  • theme show <unknown> errors instead of silently printing the default theme
  • README and docs/configuration.md updated to match

Breaking

grut doctor alone no longer exits non-zero on a failed required check. Add --check to restore the gate. Without the flag it is a diagnostic that exits 0, which keeps it usable mid-pipeline and is what makes --check meaningful in the first place.

theme show

theme.Load falls 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 for show, where grut theme show grubvox printed the default theme and exited 0, hiding the typo. Validation happens against ListThemes() (built-in plus custom) before Load is 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 before load runs.

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 <[email protected]>
Copilot-Session: c5a9c45a-0341-46e5-8458-f4060ddd58c7
@jongio
jongio merged commit 05616c9 into main Aug 5, 2026
4 checks passed
@jongio
jongio deleted the fix/cli-check-conventions branch August 5, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant