Skip to content

Commit

Permalink
feat(lib): make clap and colored_json optional (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamafaktory committed Dec 18, 2021
1 parent 7d3ef0c commit 5db32d9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
20 changes: 13 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ version = "3.0.6-alpha.0"
criterion = "0.3.5"

[dependencies]
anyhow = "1.0.45"
clap = { version = "3.0.0-rc.4", features = ["cargo"] }
colored_json = "2.1.0"
anyhow = "1.0.51"
# Mark clap and colored_json as optional.
# See: https://github.com/rust-lang/cargo/issues/1982
clap = { version = "3.0.0-rc.7", features = ["cargo"], optional = true }
colored_json = { version = "2.1.0", optional = true }
pest = "2.1.3"
pest_derive = "2.1.0"
rayon = "1.5.1"
Expand All @@ -36,7 +38,11 @@ features = ["attributes", "unstable"]
[dependencies.serde_json]
default-features = false
features = ["preserve_order"]
version = "1.0.69"
version = "1.0.73"

# See comment above.
[features]
default = ["clap", "colored_json"]

[[bench]]
harness = false
Expand All @@ -50,6 +56,7 @@ path = "src/lib.rs"
[[bin]]
name = "jql"
path = "src/bin.rs"
required-features = ["clap", "colored_json"]

[profile.release]
codegen-units = 1
Expand Down
12 changes: 12 additions & 0 deletions tests/integration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#![deny(unsafe_code, nonstandard_style)]
#![forbid(rust_2018_idioms)]

use jql::walker;
use serde_json::json;

#[test]
fn integration() {
let json_array = json!([2, 3, 5, 7, 11]);

assert_eq!(walker(&json_array, Some("[4]")), Ok(json!(11)));
}

0 comments on commit 5db32d9

Please sign in to comment.