fix(builtins): improve AWK, jq, sed, and subshell capabilities#191
Closed
fix(builtins): improve AWK, jq, sed, and subshell capabilities#191
Conversation
AWK improvements:
- Add match() function with RSTART/RLENGTH support
- Add gensub() function for global/nth substitution
- Add power operator ^ and ** support
- Fix printf width specifiers (%5s, %-20s, %05d) and add %x, %o, %c
- Fix -F'\t' escape sequence handling for tab delimiters
- Fix as_bool for numeric strings (enables !$1 patterns)
- Add exit statement with code support
- Add $0 modification with field re-splitting
- Process escape sequences (\n, \t) in format strings
jq improvements:
- Replace line-by-line JSON parsing with streaming deserializer
- Properly handle multi-line pretty-printed JSON input
- Works for both regular and slurp (-s) modes
sed improvements:
- Fix ampersand (&) replacement using ${0} to avoid regex ambiguity
- Add \n and \t escape handling in replacement strings
- Unskip pattern range addressing tests (/start/,/end/)
Subshell output redirection:
- Add redirect support to Command::Compound AST node
- Parse trailing redirections (>, >>, 2>, etc.) after ), }, fi, done
- Apply redirections when executing compound commands
Unskipped 14 spec tests across AWK and sed.
https://claude.ai/code/session_014b3FmJKqDyhYrisYnGC2M9
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Author
|
Splitting into per-fix PRs as requested. |
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.
Summary
match(),gensub(), power operator (^/**), printf width/format specifiers (%5s,%x,%o,%c), fix-F'\t'escape handling, fixas_boolfor numeric strings, addexitwith code,$0modification with re-split&replacement ambiguity, add\n/\tescapes in replacement, unskip pattern range addressing(cmd) > file)Test plan
cargo fmt --checkcleancargo clippy --all-targets --all-features -- -D warningsclean