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

Suggest cargo uninstall when cargo rm found nothing but an installed binary with the same name #11236

Open
weihanglo opened this issue Oct 13, 2022 · 4 comments
Assignees
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@weihanglo
Copy link
Member

weihanglo commented Oct 13, 2022

Problem

As cargo-rm is going to stabilize, people might make a mistake that using cargo rm to uninstall installed binaries. It would be helpful if Cargo guides them to run cargo uninstall to do a real uninstall.

Proposed Solution

The remove happens here. And this is how the result of cargo install --list get retrieved.

We can make remove_from_table return a CargoResult<bool> to indicate the existence of the given dependency. Then in ops::cargo_remove::remove we can query the installed binary list and make a suggestion like:

the dependency `{name}` could not be found in `{table}`,
but found an installed binary `{name}`.

Run `cargo uninstall {name}` if you want to uninstall the binary.

Notes

If there is already a similar issue, I am sorry and maintainer can close this.

This feature may be too clever. I believe somebody will hit filesystem permission issues and complain cargo remove shouldn't touch things outside the current package.

Personally, I don't want Cargo starts giving false positive suggestions. If we are not confident in our suggestions, maybe don't give any. (or at least use a less assertive tone)

@weihanglo weihanglo added A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels Oct 13, 2022
@weihanglo
Copy link
Member Author

Just realized this is a good example that each cargo command reuses ops from each other.

@EpicLiem
Copy link

Can you assign this to me?

@weihanglo
Copy link
Member Author

Feel free to use triagebot to do so.

@EpicLiem
Copy link

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. 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