killercup / cargo-edit

A utility for managing cargo dependencies from the command line.
http://killercup.github.io/cargo-edit/
MIT License
3.01k stars 144 forks source link

cargo-use as alias for cargo-add #880

Closed WalterSmuts closed 7 months ago

WalterSmuts commented 7 months ago

The suggestion is simple: Add cargo-use as an alias for cargo-add. I gave a quick search for cargo-use in the issues but couldn't find anything.

The reasoning is to align the keywords used in Rust code itself for importing external dependencies to a module with the keyword used in cargo to add the dependency to the crate:

use dep_crate::OtherStruct;

I'm somewhat surprised I didn't find anything (although can't say I've done the most thorough search). I personally get this error message very frequently:

$ cargo use dep
error: no such command: `use`

    Did you mean `add`?

    View all installed commands with `cargo --list`

I suspect this was top of mind at some point, i.e. someone went through the effort to add the message, but made a decision not to simply add an alias.

epage commented 7 months ago

cargo add is no longer maintainer here but in the cargo repo.

Personally, I suspect this won't happen. Shorthands for commands are understanble but I could see a lot of confusion coming from alternative names for commands. There is a lot of momentum behind the add name (years of use in cargo, use elsewhere) so I doubt we'd want to shift focus.

But I'm only one voice in this.