Proposed Feature: Ability to hide and unhide nodes
One of jless's major strength over simple pretty-printing of JSON is the interactivity it provides. This PR adds support for hiding and unhiding of individual map key nodes (based on jq query matching), enhancing the interactivity by allowing user to hide irrelevant nodes to better navigate and view the JSON.
The attached video demonstrates three features:
Using x to hide individual object keys (ServiceId, ServiceType and AvailabilityZones). Notice that the objects keys are hidden across all objects in the ServiceDetails array.
Using u to undo hiding of the above object keys one at a time
Using U to undo hiding of all object keys all at once
Proposed Feature: Ability to hide and unhide nodes
One of jless's major strength over simple pretty-printing of JSON is the interactivity it provides. This PR adds support for hiding and unhiding of individual map key nodes (based on jq query matching), enhancing the interactivity by allowing user to hide irrelevant nodes to better navigate and view the JSON.
The attached video demonstrates three features:
x
to hide individual object keys (ServiceId
,ServiceType
andAvailabilityZones
). Notice that the objects keys are hidden across all objects in theServiceDetails
array.u
to undo hiding of the above object keys one at a timeU
to undo hiding of all object keys all at oncehttps://github.com/PaulJuliusMartinez/jless/assets/14101781/bdf0911d-f905-4a46-83d0-ee88402a579b
Changes
vec<string>
field on theflatjson
struct to storejq
paths for testing which rows to hide.x
is pressed, we generate thejq
path for the current node, and push it to the above vector.u
is pressed, we pop the last item of the above vector.U
is pressed, we clear the vector.flatjson::next_visible_row()
andflatjson::prev_visible_row()
to skip over hidden rows.jq
path is included in the vector above.