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

provide feature to disable cli(clap) for libs #170

Closed
kolbma opened this issue Nov 13, 2022 · 1 comment
Closed

provide feature to disable cli(clap) for libs #170

kolbma opened this issue Nov 13, 2022 · 1 comment

Comments

@kolbma
Copy link

kolbma commented Nov 13, 2022

Hello,

can you please provide a feature to disable the cli dependencies for using your lib without pulling in the clap dependency!

serde has a derive feature (no need for serde_derive crate) and serde_json is also cli.

More or less this should be all to do...

# Cargo.toml
[dependencies]
clap = { version = "4", features = ["derive", "cargo", "wrap_help", "deprecated"], optional = true }
clap_complete = { version = "4", optional = true }
clap_mangen = { version = "0.2", optional = true }
iban_validate = "4"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", optional = true }

[features]
default = ["cli"]
cli = ["clap", "clap_complete", "clap_mangen", "serde_json"]
// src/bin/cli.rs
#![cfg(feature = "cli")]

use std::{error::Error, io};

[...]
// tests/cli.rs
#![cfg(feature = "cli")]

use std::process::Command;

[...]

Thx

@svenstaro
Copy link
Owner

This should be done as of v1.3.0. :)

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 a pull request may close this issue.

2 participants