Commit 94ac5dd
fix(builtins): add jq -R raw input and awk printf parens (#388)
## Summary
- **jq**: Implement `-R`/`--raw-input` flag — treats each input line as
a JSON string instead of parsing as JSON. Also supports `-Rs` (slurp
entire input as single string). Unblocks CSV processing patterns like
`jq -Rs 'split("\n")'`.
- **awk**: Support `printf("format", args)` parenthesized syntax in
addition to existing `printf "format", args`. Common in awk scripts for
JSON generation.
## Root cause
- Issue #368: `complex_markdown_toc` eval failures were caused by awk
`printf("format")` syntax not being supported, not tr character classes
as initially suspected
- Issue #369: `data_csv_to_json` eval failures were caused by missing
`jq -R` raw input mode, preventing CSV-to-JSON conversion patterns
## Test plan
- [x] Added unit tests for `jq -R`, `jq -Rs`, and `jq -Rs` with split
- [x] Added unit tests for awk `printf("format", args)` and CSV-to-JSON
pattern
- [x] Added spec tests: `jq_raw_input`, `jq_raw_input_slurp`,
`awk_printf_parens`, `awk_printf_parens_begin`
- [x] All existing tests pass (AWK: 98, JQ: 115, Bash: 1214)
- [x] `cargo clippy` clean, `cargo fmt` clean
Closes #368
Closes #369
Co-authored-by: Claude <noreply@anthropic.com>1 parent 385ded2 commit 94ac5dd
File tree
4 files changed
+119
-0
lines changed- crates/bashkit
- src/builtins
- tests/spec_cases
- awk
- jq
4 files changed
+119
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
685 | 693 | | |
686 | 694 | | |
687 | 695 | | |
| |||
701 | 709 | | |
702 | 710 | | |
703 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
704 | 719 | | |
705 | 720 | | |
706 | 721 | | |
| |||
3269 | 3284 | | |
3270 | 3285 | | |
3271 | 3286 | | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
3272 | 3315 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| 214 | + | |
| 215 | + | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
| |||
269 | 272 | | |
270 | 273 | | |
271 | 274 | | |
| 275 | + | |
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
| |||
377 | 381 | | |
378 | 382 | | |
379 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
380 | 393 | | |
381 | 394 | | |
382 | 395 | | |
| |||
1189 | 1202 | | |
1190 | 1203 | | |
1191 | 1204 | | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1192 | 1236 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
954 | 954 | | |
955 | 955 | | |
956 | 956 | | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
0 commit comments