MiSawa / xq

Pure rust implementation of jq
MIT License
333 stars 18 forks source link

Get placeholder error on del/1 function #71

Closed itchyny closed 2 years ago

itchyny commented 2 years ago
❯ jq -n '{x:[1]} | del(.x[0],.x)'
{}

❯ xq -n '{x:[1]} | del(.x[0],.x)'
Error: IndexOnNonIndexable("placeholder")
MiSawa commented 2 years ago

More cases to test:

$ jq -n '{x:[1]} | del(.x.y, .x[0], .x)'
jq: error (at <unknown>): Cannot index array with string "y"
[2]    563536 exit 5     jq -n '{x:[1]} | del(.x.y, .x[0], .x)'
$ jq -n '{x:[1]} | del(.x[0], .x.y, .x)'
jq: error (at <unknown>): Cannot index array with string "y"
[2]    563544 exit 5     jq -n '{x:[1]} | del(.x[0], .x.y, .x)'

and nested slices.

wader commented 2 years ago

@itchyny @MiSawa just want to say thanks for interesting issues and fixes, learning a lot about jq. Would like to learn more rust so maybe xq could be a good motivation!

MiSawa commented 2 years ago

Hi @wader, welcome to the repo! If you'd like to learn jq / rust using xq, and have any questions/problems related to xq, please don't hesitate to post an issue or measage me :)