Separate crate from cli
wiseaidev opened this issue · comments
As frens suggested, It would be best to separate crate from cli probably using cargo features:
[dependencies]
clap = { version = "4.4.12", features = ["derive"] , optional = true }
[features]
cli = ["dep:clap"]
And then mark the main function like:
#[cfg(feature = "cli")]
pub fn main() {
}
What do you think?
CLI isn't a part of the api that would be used by people using this project as a dependency. And that's why it should be not included in this crate at all imo.
that's why it should be not included in this crate at all imo.
Yup. But. do you think it is optimum to follow the suggestion above that will exclude the cli if you wanna add the crate as dep instead of splitting the project into two separate crates?
[dependencies]
ipcap = { version = "0.1.0" }
In this case, the cli
will not be installed because the cli
feature is not enabled like so:
[dependencies]
ipcap = { version = "0.1.0", features = ["cli"] }
Now, the question is: Will this remove clap
and all its related code from compilation step? That's something we should experiment with. What do you think?