Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement KDL Query Language #2

Merged
merged 1 commit into from
Oct 19, 2021
Merged

Implement KDL Query Language #2

merged 1 commit into from
Oct 19, 2021

Conversation

jihchi
Copy link
Owner

@jihchi jihchi commented Sep 14, 2021

Original idea comes from kdl-org/kdl#55

Such that we could use KDL Query Language as the query and transform kdl.

KDL Query Language Spec

Changelogs

  • Implement a parser for KDL Query Language Spec
  • Integrate the parser into this CLI tool

Examples

Based on https://github.com/kdl-org/kdl/blob/main/QUERY-SPEC.md#examples

$ 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

@jihchi jihchi force-pushed the implement_query_language branch from 9588137 to 6a687ed Compare October 10, 2021 02:57
@jihchi jihchi force-pushed the implement_query_language branch 4 times, most recently from a92a95b to 46d3dde Compare October 19, 2021 04:16
@jihchi jihchi force-pushed the implement_query_language branch from 46d3dde to b3275fb Compare October 19, 2021 04:17
@jihchi jihchi merged commit df62722 into main Oct 19, 2021
@jihchi jihchi deleted the implement_query_language branch October 19, 2021 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant