Skip to content

Option to set exit status code when query doesn't yield any results #189

@Yv-vY

Description

@Yv-vY

Problem Statement

There's currently no programmatic way of testing if a node has been found.

It would be nice to add an option (maybe -s) so xq return an exit status code depending on wether a node has been found or not, à la grep.

Expected Result

> echo '<?xml version="1.0"?><root></root>' | xq -s -q none
> echo $?
1

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions