Skip to content

Stop CLI commands when configuration is invalid - #89

Merged
Gubarz merged 1 commit into
cheatmd-dev:mainfrom
echo8134:fix/invalid-config
Sep 30, 2026
Merged

Gubarz merged 1 commit into
cheatmd-dev:mainfrom
echo8134:fix/invalid-config

Conversation

@echo8134

Copy link
Copy Markdown
Contributor

Summary

Configuration errors were printed from Cobra initialization while commands continued and returned success. Return config errors through the root persistent pre-run hook. This also aborts widget and completion commands on invalid configuration; help remains available.

Related issues

No linked issue.

Verification

Tests cover the root, dump and widget commands. Built dump runs cover valid and invalid configuration. Repository search confirms that no subcommand overrides the persistent pre-run hook.

Local checks passed on Go 1.27.1. The CI workflow uses Go 1.26.3.

Checklist

  • go build ./... and go test ./... pass
  • gofmt -l . and go vet ./... are clean
  • Added regression tests for the changed behavior
  • cheatmd --lint examples/ passes
  • Docs/wiki changes are not needed for this fix

@Gubarz
Gubarz marked this pull request as ready for review September 30, 2026 14:57
@Gubarz
Gubarz merged commit da2eb3e into cheatmd-dev:main Sep 30, 2026
1 check passed
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.

2 participants