Skip to content
/ kq Public

A jq-like CLI tool that allows querying and transforming KDL documents directly from the command line

License

Notifications You must be signed in to change notification settings

jihchi/kq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kq

Crates.io - version Crates.io - download docs.rs

A jq-like cli tool that can query KDL document right in the command line.

Installation

Pre-built binaries

You can find prebuilt binaries for Linux, macOS and Windows in the release page.

Cargo

$ cargo install kq

Container

$ docker run ghcr.io/jihchi/kq -v

Usage

$ kq -h
Usage: kq [options] <selector>

Options:
    -h, --help          print this help menu
    -v, --version       print the version

Examples

Modified from https://github.com/kdl-org/kdl/blob/1.0.0/QUERY-SPEC.md#examples

Given following content:

$ cat example.kdl
package {
    name "foo"
    version "1.0.0"
    dependencies platform="windows" {
        winapi "1.0.0" path="./crates/my-winapi-fork"
    }
    dependencies {
        miette "2.0.0" dev=true
    }
}
$ cat example.kdl | kq "package name"
name "foo"
$ cat example.kdl | kq "dependencies"
dependencies platform="windows" {
    winapi "1.0.0" path="./crates/my-winapi-fork"
}
dependencies {
    miette "2.0.0" dev=true
}
$ cat example.kdl | kq "dependencies[platform]"
dependencies platform="windows" {
    winapi "1.0.0" path="./crates/my-winapi-fork"
}
$ cat example.kdl | kq "dependencies > []"
winapi "1.0.0" path="./crates/my-winapi-fork"
miette "2.0.0" dev=true

About

A jq-like CLI tool that allows querying and transforming KDL documents directly from the command line

Resources

License

Stars

Watchers

Forks

Packages