tokei icon indicating copy to clipboard operation
tokei copied to clipboard

Remove clap Dependency From Library

Open theduke opened this issue 3 years ago • 7 comments

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

Would be great to only use clap in the binary.

theduke avatar Mar 09 '21 14:03 theduke

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?

XAMPPRocky avatar Mar 09 '21 14:03 XAMPPRocky

Making clap an optional dependency might work, too.

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

vks avatar Apr 25 '21 22:04 vks

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

brightly-salty avatar Jun 27 '21 15:06 brightly-salty

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.

XAMPPRocky avatar Jun 27 '21 17:06 XAMPPRocky

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?

nicolacSNPS avatar Sep 10 '21 17:09 nicolacSNPS

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.

vks avatar Sep 10 '21 21:09 vks

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 :)

nicolacSNPS avatar Sep 10 '21 22:09 nicolacSNPS