Commit 5a7e6e2
authored
feat: Add
* feat: Add `htmlhint --init` command
This creates a new config (if one doesn't already exist)
* make the --init command much more robust and follows standard CLI best practices
Updated behavior:
Exit code 0 (success):
✅ Config file created successfully
✅ Config file already exists (no action needed, but not an error)
Exit code 1 (failure):
❌ File creation failed due to write permissions, disk space, etc.
Why this is better:
Follows CLI conventions: Failed operations should exit with non-zero codes
Better for scripting: Scripts can check $? or $LASTEXITCODE to handle errors
More user-friendly: Existing file is treated as success, not failure
Proper error handling: Real write errors are properly reported
Updated tests:
✅ All tests pass
✅ Tests verify correct exit codes for each scenario
✅ Tests handle platform differences (Windows vs Unix)
This change makes the --init command much more robust and follows standard CLI best practices.
* Fix flaky testhtmlhint --init command (#1630)1 parent 4c13ef9 commit 5a7e6e2
3 files changed
+147
-2
lines changed
0 commit comments