`cargo install uuid` should give me a uuid tool
ctsrc opened this issue · comments
Motivation
cargo install uuid
results in:
error: there is nothing to install in `uuid v1.3.0`, because it has no binaries
`cargo install` is only for installing programs, and can't be used with libraries.
To use a library crate, add it as a dependency in a Cargo project instead.
It would be highly desirable to have it also be installable as a cli tool.
This was discussed in the past but not acted upon. I think now is a good time to revisit this idea.
Solution
The uuid
crate should include a binary target that is compatible with https://linux.die.net/man/1/uuid
Alternatives
Some suggested to make a separate crate. But it would be better to have the uuid
crate include the binary because of multiple reasons:
- The binary name will be
uuid
. So the crate name should beuuid
. - The
uuid
crate is the most dominant result for searches like Rust uuid on Google - Allowing to install a binary using the crate name makes it easy and convenient
- There is no drawback.
cargo install uuid
will only be done when people want it to install binaries.
Anything else?
Previous discussion from years ago was at #72
There is no drawback. cargo install uuid will only be done when people want it to install binaries.
This isn't true- there's a maintenence burden associated with it, and that's a pretty clear drawback.
Would the maintainers of this project entertain a PR that adds a uuid
binary crate to this package?
I personally think that lib and bin implementations should go in separate crates due to how cargo
currently handles dependencies
There's no good way of having bin vs lib dependencies which normally means that extra dependencies for the binary get pulled in for the library too unless explicitly disabled through features
At one point I did start uuid-rs/ruuhid
, however I just never around to actually get a functional tool before life got too busy
You are free to PR there and the project could be restarted.
I don't think we'll be adding binary support to the uuid
library itself, since the library supports almost nothing in its default state, and we wouldn't want consumers to have to opt-out of features.
If a good-quality CLI emerges then I'd gladly link it in the readme here, which should help direct anybody coming via search engines specifically looking for a CLI.