Crates.io | yquery |
lib.rs | yquery |
version | 0.1.1 |
source | src |
created_at | 2022-01-03 18:12:49.67749 |
updated_at | 2022-01-03 20:48:07.595485 |
description | yquery is a yaml-query command-line utility based on the idea of jquery |
homepage | |
repository | https://github.com/madsravn/yquery |
max_upload_size | |
id | 507245 |
size | 19,589 |
yquery is a program which finds elements in your yaml documents using selectors. Sort of like how jquery works for css.
yquery is a command-line tool which currently accepts one file and a 'search query'. It will then search through the document looking for elements of the document which adhere to the search query. I am currently working on multi-file support so you can search directories as well.
A 'search query' consists of three parts: A element name, a child specifier and id selection. It is given in the form ElementA[childname=name].id
. You can have multiple occurrences of each part: (ElementA|ElementB)[childname=name,childage=age].(id,name)
. If only the element name part is given, the output will the entire element found, as seen in the first example below. If the id selection part is specified, you will only receive those specifically, as seen in the second example below.
Example with no id specifier
[mads@Adria][~/projects/yquery]% yquery documents/verify_apache.yaml "service"
service: { name: httpd, state: started}
service: { name: httpd, state: restarted}
Example with id specifier set
[mads@Adria][~/projects/yquery]% yquery documents/verify_apache.yaml "service.name"
httpd
httpd
Currently yquery does not reside in any package manager that I know of. So in order to install it you need to build the tool yourself.
You can also build and install from source (requires the latest stable Rust compiler.)
cargo install --git https://github.com/madsravn/yquery.git yquery
Some issues can arise from the grammar I made to parse the search query. If you are in doubt whether or not your query was understood correctly, run the program with a third parameter. Then it will output how it understands your search query.
This tool and its source is licensed under GNU GPLv3