Skip to main content

YAML query utility

Project description

QYAML — query YAML with YAML with YAML result

Walk synchronously through query and doc, and print the list of matching branches of doc as a YAML document.

Result is printed to standard output as a list of found matches, including their keys.

Given file.yaml:

dict:
  first: value1
  second: value2

QYAML may be used to query, for example, the value of the first key of the dict dictionary:

$ qyaml "dict: first" < file.yaml
- dict:
    first: value1

The query is itself a YAML document.

The output may be flatten with fyaml to only values (default behavior) or preserving the keys with keys argument, or format as a JSON string with json argument:

$ cat file.yaml | qyaml "dict: first" | fyaml
value1

$ cat file.yaml | qyaml "dict: first" | fyaml keys
first: value1

$ cat file.yaml | qyaml dict | fyaml json
["value1", "value2"]

$ cat file.yaml | qyaml dict | fyaml json keys
[{"first": "value1"}, {"second": "value2"}]

Query rules

Query\Document String Number Boolean List Dictionary
String (regexp) regex-match - - regex-match list elements regex-match keys
Number str[i] match - list[i] -
Boolean - - match - b ? values : keys
List for-each - - match list[i] for each q search keys
Dictionary - - - i: match, bool: filter key:value match

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qyaml-smartptr-0.0.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qyaml_smartptr-0.0.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file qyaml-smartptr-0.0.2.tar.gz.

File metadata

  • Download URL: qyaml-smartptr-0.0.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for qyaml-smartptr-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0b5f33afeafac0dd6c57cd557b1b31732d84daadccf9bb20428690b692230aa0
MD5 b6dc5c6b02c76b1bcb39a689f4773f44
BLAKE2b-256 0f602663fc389fbeca5a8e5c4010c7cf4204e0ed58998fd6fb96645cecf4f465

See more details on using hashes here.

File details

Details for the file qyaml_smartptr-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: qyaml_smartptr-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for qyaml_smartptr-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1f41d2ea99e7b5f4486b53866c3251684e26599cb8407343f849a03e1afaff2c
MD5 73f2b29b737243040581fd9711ac32c2
BLAKE2b-256 6115cb85d5ea6404027ba3cac41b3f88994e8ec4598c45ce5a7de407bcec2a75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page