thomas9911 / yaml-query

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YamlQuery

YamlQuery provides a simple way to execute JQL queries on yaml files.

See https://github.com/yamafaktory/jql for documentation on jql syntax.

Functions

from_file(path, query)

@spec from_file(path :: binary(), query :: binary()) :: {:ok, term()} | {:error, atom() | binary()}

Execute a jql query on the given yaml file.

query(yaml, query)

@spec query(yaml :: binary(), query :: binary() | charlist()) :: {:ok, term()} | {:error, binary()}

Execute a jql query on the given yaml string.

yaml = """

test:

  nested: 'test'

"""

YamlQuery.query(yaml, ~S|"test""nested"|)
{:ok, "test"}

Also support for single quotes, so bash queries can be copied over.

yaml = """

test:

  nested: 'test'

"""

YamlQuery.query(yaml, '"test""nested"')
{:ok, "test"}

About


Languages

Language:Elixir 93.3%Language:Rust 6.7%