rust-lang / rust-lang/cargo

cargo install --divert?

Open
#8,250 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request Command-install S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve
Some tools (reportedly, a "brew doctor"), dislike when some executables have some names.
Sometimes executable names collide or just aren't that good in the first place.

A mechanism similar to dpkg-divert can solve both of those issues, by allowing per-install renames (or, when used with a persistent config like cargo-install-update-config, per-user renames) of installed executables.

This amounts to a much more versatile and non-upstream-intrusive equivalent of Cargo.toml specifying two executables and then filtering any of them out with --bin.

Describe the solution you'd like
cargo install --divert treesize=trize treesize would install the treesize binary of the treesize crate as trize, presumably with ~/.cargo/.crates.toml containing something in the likes of "treesize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["trize.exe"].

Notes
This could also be done outside of cargo, and, if the maintainers decide against this, I'll end up implementing it in cargo-update, but I'd prefer to not rewrite cargo state with no stability guarantees.

If, however, the maintainers like this idea, I could (at least try to) implement this for cargo in the coming weeks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cargo install command and the ~/.cargo/.crates.toml state described in the proposal, then determine how per-install executable renames should be represented and persisted. Done means a decided, documented behavior for --divert, including the treesize=trize example and compatibility with existing install tracking.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.