Skip to content

Add CLI validator for TOML syntax validation#9

Merged
dereuromark merged 2 commits intomasterfrom
feature/cli-validator
Mar 25, 2026
Merged

Add CLI validator for TOML syntax validation#9
dereuromark merged 2 commits intomasterfrom
feature/cli-validator

Conversation

@dereuromark
Copy link
Contributor

Summary

  • Adds toml-validate CLI command for validating TOML file syntax
  • Supports stdin input for piping (cat file.toml | toml-validate)
  • Optional JSON Schema validation via --schema flag (requires justinrainbow/json-schema)
  • Proper exit codes for CI/CD integration

Usage

# Validate a file
toml-validate config.toml

# Pipe from stdin
cat config.toml | toml-validate

# With JSON Schema validation
toml-validate config.toml --schema=schema.json

# Quiet mode for scripting
toml-validate config.toml -q && echo "Valid!"

Exit codes

Code Meaning
0 Valid TOML
1 Invalid TOML (syntax errors)
2 Schema validation failed
3 File not found / read error

This enables the library to be listed on the TOML validators wiki.

Adds `toml-validate` CLI command that:
- Validates TOML file syntax
- Supports stdin input for piping
- Optional JSON Schema validation via --schema flag
- Returns proper exit codes for CI/CD integration:
  - 0: Valid TOML
  - 1: Invalid TOML (syntax errors)
  - 2: Schema validation failed
  - 3: File not found / read error
@dereuromark dereuromark added the enhancement New feature or request label Mar 25, 2026
Documents the toml-validate command with:
- Installation and usage examples
- Exit codes reference
- CI/CD integration examples (GitHub Actions, GitLab CI, pre-commit)
- Schema validation with JSON Schema
- Scripting examples
@dereuromark dereuromark merged commit 5452186 into master Mar 25, 2026
3 checks passed
@dereuromark dereuromark deleted the feature/cli-validator branch March 25, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant