XAMPPRocky / tokei

Count your code, quickly.
Other
11.02k stars 532 forks source link

Remove clap Dependency From Library #737

Open theduke opened 3 years ago

theduke commented 3 years ago

When using tokei as a library, you still get clap as a dependency.

Would be great to only use clap in the binary.

XAMPPRocky commented 3 years ago

Thank you for your issue! However I'm afraid, there's not much that I can do. This more an issue with cargo. See this issue for more information, I could probably restructure the project to remove the dependency from the library, however I'm not really sure it's worth it in terms of time or effort, have you noticed a meaningful compile time improvement if not compiled with clap?

vks commented 3 years ago

Making clap an optional dependency might work, too.

Alternatively, the binary and the library could be split into separate packages.

brightly-salty commented 3 years ago

I'd be willing to attempt restructuring the project into separate packages and submit a PR if @XAMPPRocky is okay with it.

XAMPPRocky commented 3 years ago

Hmm, right now I still don't really the value in splitting the project up, I would think the energy would be better spent trying to push for [bin-dependencies] or similar in Cargo.

nicolacSNPS commented 3 years ago

Without restructuring the project, maybe defining the clap dependency as optional and being guarded by a "cli" feature that is enabled by default?

Like this when I import tokei I can disable most features and get rid of these unnecessary dependencies like clap?

vks commented 3 years ago

Like this when I import tokei I can disable most features and get rid of these unnecessary dependencies like clap?

This should work, but I think you will have to use the new resolver for that.

nicolacSNPS commented 3 years ago

Like this when I import tokei I can disable most features and get rid of these unnecessary dependencies like clap?

This should work, but I think you will have to use the new resolver for that.

I am, and its becoming default in the next edition coming very soon :)