Add --validate flow with per-entry no_expand#32
Merged
Conversation
Enable standalone validation and expansion control across files - Add `-V/--validate` CLI flag to run env-file validation as a separate flow and disallow conflicting options - Introduce per-entry `no_expand` flag on `EnvValue`; default remains false and single-quoted values are treated as literals when set - Refactor parsing to collect all formatting issues (whitespace around `=` and duplicates) and return a single `EnvParseError` with the first offending line and a combined message; apply `no_expand` for single-quoted values - Centralize path resolution in `resolve_env_path` (defaults, absolute resolution, existence checks); main uses it and prints `<path> is valid` on success - Update error output to print only the error message and remove ad-hoc path handling in run paths - Update README: align badge to Rust branding and add a “Validating a File” section with an example (`dotenv --validate --file .env.example`) - Add tests/fixtures for validation: `space.env` and `singleQuote.env`, test valid/invalid/missing cases, exclusivity with other options, and whitespace/duplicate-key diagnostics - Improve error messaging for unterminated quotes and extend tests for quote-sensitive expansion and end-to-end fixture validation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Closed
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.
Enable standalone validation and expansion control across files
-V/--validateCLI flag to run env-file validation as a separate flow and disallow conflicting optionsno_expandflag onEnvValue; default remains false and single-quoted values are treated as literals when set=and duplicates) and return a singleEnvParseErrorwith the first offending line and a combined message; applyno_expandfor single-quoted valuesresolve_env_path(defaults, absolute resolution, existence checks); main uses it and prints<path> is validon successdotenv --validate --file .env.example)space.envandsingleQuote.env, test valid/invalid/missing cases, exclusivity with other options, and whitespace/duplicate-key diagnostics