MiSawa / xq

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

sort_by does not support multiple comparators #40

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

The sort_by filter of jq allows to specify multiple comparators in case the first one emits the same value.

 $ jq -nc '[{x:1,y:2},{x:2,y:2},{x:2,y:1},{x:1,y:1}] | sort_by(.x,.y)'
[{"x":1,"y":1},{"x":1,"y":2},{"x":2,"y":1},{"x":2,"y":2}]
 $ xq -nc '[{x:1,y:2},{x:2,y:2},{x:2,y:1},{x:1,y:1}] | sort_by(.x,.y)'
[1,2,1,2]