Repository navigation
feat: named rules - #22
Merged
Merged
Conversation
- rule <name>: with sub, level, exit, flag fields and a do: body - a rule whose fields do not hold is skipped, so the next rule runs - flag guards accept spellings: -o|--output json - --explain prints the rule name - runnable example in examples/named-rules
- guard handles back-to-back documents and warning lines around JSON - filtered output with leftover fragments is rebuilt from the raw JSON - rewrite sets LOWFAT_PIPED when stdout is piped or redirected - with LOWFAT_PIPED, JSON output passes through byte-exact - end-to-end test over bundled filters and fixture plugins
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.
What changes
.lffile can declarerule <name>:blocks withsub,level,exitandflagfields and ado:body. A rule whose fields do not hold is skipped, so the next rule runs. Oldselector:rules still parse.-o|--output json.rewritesetsLOWFAT_PIPED=1when stdout is piped or redirected. With it set, JSON output passes through byte-exact, sokubectl get pods -o json | jqsees real data.Testworkflow runscargo test --workspaceon pull requests and onmain.Testing
cargo test --workspacepasses in a Linux container.crates/lowfat/tests/json_e2e.rsruns 2,880 end-to-end cases. It fails on the previous guard code (810 broken) and passes here.Notes
ruleblocks need lowfat 0.9.0 or newer.