Package: wildq
wildq - Command-line TOML/JSON/INI/YAML/XML/HCL processor using jq c bindingsPurpose of this package is to provide a simple wrapper arround jq for different formats.
I'm tired of searching a package doing yaml jq, toml jq, ini jq etc. mainly used for scripting.This script uses:@mwilliamsonPython bindingson top of @stedolan famousjqlibswiss knife for colorationpygmentsbinary built withpyinstallereasy CLI withclickfor supported types sources, check tableSupported file typesInstallationYou could install via pipx, pip, brew, deb, rpm or fallback to binary version.Pipxpipxinstall and run python applications in isolated environmentspipxinstallwildqPippipinstallwildqMacOSbrew install ahmet2mir/tap/wildq
brew install ahmet2mir/tap/wqDebian (no gpg signature) >= 10VERSION=$(curl -s "https://api.github.com/repos/ahmet2mir/wildq/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -sL https://github.com/ahmet2mir/wildq/releases/download/v${VERSION}/wildq_${VERSION}-1_amd64.deb -o wildq_${VERSION}-1_amd64.deb
sudo dpkg -i wildq_${VERSION}-1_amd64.deb

wq --help
wildq --helpCentos (no gpg singature) >= 7VERSION=$(curl -s "https://api.github.com/repos/ahmet2mir/wildq/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -sL https://github.com/ahmet2mir/wildq/releases/download/v${VERSION}/wildq-${VERSION}-1.x86_64.rpm -o wildq-${VERSION}-1.x86_64.rpm
sudo yum install -y ./wildq-${VERSION}-1.x86_64.rpm

wq --help
wildq --helpGentoo@zmedicodid a portage onapp-miscemerge -av app-misc/wildqGNU/Linux BinaryCompiled using glibc 2.17, it should work on lot of stable/LTS distros.mkdir -p ~/bin/
VERSION=$(curl -s "https://api.github.com/repos/ahmet2mir/wildq/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -sL https://github.com/ahmet2mir/wildq/releases/download/v${VERSION}/wildq-${VERSION}-linux-x86_64.tar.gz -o wildq-${VERSION}-linux-x86_64.tar.gz
tar xvfz wildq-${VERSION}-linux-x86_64.tar.gz -C ~/bin
export PATH="~/bin:$PATH"

wq --help
wildq --helpWindowsWildq usejq.pyand it's not yet available on windows platforms.
I tried to compile it without windows machine and I failed, and I don't had the time to try to understand how Windows / C binding / Python works.
If anybody would contribute, there is anopen issue(jq and onigurama are 'compilable' on Windows so I think that someone confortable with that OS could make it);Supported file typestypecolororderingoutputsourcehcljsonnojsonpyhclby @virtualdiniyesnoyesConfigParserjsonyesyesyesjsontomlyesnoyestomlby @uirixmlyesnoyesxmldictby @martinblechyamlyesyesyespyyamlUsage$ wildq --help
Usage: wildq [OPTIONS] JQ_FILTER [FILE]

Options:
  -c, --compact-output            compact instead of pretty-printed output
  -r, --raw                       output raw strings, not content texts
  -C, --color-output              colorize content (default), mutally
                                  exclusive with --monochrome-output

  -M, --monochrome-output         monochrome (don't colorize content), mutally
                                  exclusive with --color-output

  --hcl                           Combine --input hcl --output json, mutally
                                  exclusive with other Combined options

  --ini                           Combine --input ini --output json, mutally
                                  exclusive with other Combined options

  --json                          Combine --input json --output json, mutally
                                  exclusive with other Combined options

  --toml                          Combine --input toml --output json, mutally
                                  exclusive with other Combined options

  --xml                           Combine --input xml --output json, mutally
                                  exclusive with other Combined options

  --yaml                          Combine --input yaml --output json, mutally
                                  exclusive with other Combined options

  -i, --input [hcl|ini|json|toml|xml|yaml]
                                  Define the content type of file, mutally
                                  exclusive with Combined option

  -o, --output [hcl|ini|json|toml|xml|yaml]
                                  Define the content type of printed output,
                                  mutally exclusive with Combined option
                                  (default input format)

  --version                       Show the version and exit.
  --help                          Show this message and exit.For backward compatibility in previous version only--[yaml|json|toml|ini|xml|hcl]was possible with default to json output.
We still keep Monochrome, raw and json output with thoses options.
Output was similar tojq -MCr(no color, no compact and no quote on single value)But now, by default it's colorized, not raw and if you specify input using-ior--inputoutput will be the same format.There is also a shorter commandwqcomming with the package.Likejq cli, wildq supports both of stdin and file to the functionSee examples to get some example.Content ofexamples/json.json{
    "general": {
        "user": "admin"
    },
    "keys": [
        {"key": "value1"},
        {"key": "value2"},
        "alone"
    ]
}catexamples/json.json|wildq-ijson".keys[]"{"key":"value1"}{"key":"value2"}aloneorwildq-ijson".keys[]"examples/json.json{"key":"value1"}{"key":"value2"}aloneorwq-ijson".keys[]"examples/json.json{"key":"value1"}{"key":"value2"}aloneFor TOMLcatexamples/toml.toml|wildq-itoml".keys[]"{"key":"value1"}{"key":"value2"}aloneFor INI (no array)catexamples/ini.ini|wildq-iini".keys"{"key1":"value1","key2":"value2"}For XMLcatexamples/xml.xml|wildq-ixml"."{"root":{"general":{"user":"admin"},"keys":{"element":[{"key":"value1"},{"key":"value2"},"alone"]}}}For YAMLcatexamples/yaml.yaml|wildq-iyaml".keys[]"{"key1":"value1"}{"key2":"value2"}aloneFor HCLcatexamples/hcl.hcl|wildq-ihcl".keys[]"{"key":"value1"}{"key":"value2"}Tips and tricksLoop on keys in bash without creating a subshellwildq-itoml"keys[]"examples/toml.toml|whileread-rkeydoecho"Getting key${key}"doneYou could also found some examples on some blogs/websites:a complete guide with advanced examples on how to read/update files with differents processing tools(Original Japanese)(Translate EN)an example of INI manipulation made by AWS ParallelCluster Workshop(workshop)(example 1)(example 2)TODOadd tests...add more control over filters and filesuse click for the CLIsupport different outputdetect automagically filetypesupport all jq typesorderingContributingMerge requests are welcome :)LicenseLicensed under the terms of theApache License, Version 2.0.Repository URLhttps://github.com/ahmet2mir/wildq