Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install skip existing crates #6813

Closed
liamdawson opened this issue Apr 2, 2019 · 4 comments
Closed

Install skip existing crates #6813

liamdawson opened this issue Apr 2, 2019 · 4 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@liamdawson
Copy link

Describe the problem you are trying to solve
I would like to install some cargo utilities via a bootstrap script, and would like it to skip utilities that have already been installed.

Describe the solution you'd like

$ cargo install --skip-existing cargo-edit
warning: crate `cargo-add v0.3.1` already exists in destination, skipping install

Prior art from rbenv:

$ rbenv install --help
...
-s/--skip-existing Skip if the version appears to be installed already
...

This flag would output a message to stderr indicating the crate is already installed, and return a status code of 0 (instead of the current 101).

Notes
I was working around this with command -v cargo-tree | cargo install cargo-tree, but that approach fails with cargo-edit, because it adds multiple binaries, none of which are called cargo-edit. I also feel this is a simple, partial workaround to the multiple requests for using install to upgrade crates.

@liamdawson liamdawson added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 2, 2019
@ehuss
Copy link
Contributor

ehuss commented Apr 2, 2019

Thanks for the report! I've recently implemented a feature that will automatically skip the install if it is already installed. It hasn't been merged yet (#6798), but could you take a look at the documentation and let me know if it covers your needs?

@liamdawson
Copy link
Author

It would definitely cover my needs in this scenario! I thought I'd propose this as a (hopefully) uncontroversial/uncomplicated way to achieve my goals in the short term, but do you think there's any value in it vs. your PR there? (I'm happy to open a PR for this suggestion).

@ehuss
Copy link
Contributor

ehuss commented Apr 4, 2019

Probably not at this time. New features tend to go through the unstable process, and I don't think we need multiple ones doing similar functionality.

@ehuss
Copy link
Contributor

ehuss commented Sep 21, 2019

Closing in favor of #6797.

@ehuss ehuss closed this as completed Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants