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

feat(lib): make clap and colored_json optional #114

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)));
}