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

Make cargo recognize commands from uninstalled plugins #11226

Closed
estebank opened this issue Oct 12, 2022 · 6 comments
Closed

Make cargo recognize commands from uninstalled plugins #11226

estebank opened this issue Oct 12, 2022 · 6 comments
Labels
A-custom-subcommands Area: custom 3rd party subcommand plugins 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

@estebank
Copy link
Contributor

Problem

When executing cargo foo, without having executed cargo install cargo-foo beforehand, the error message will be something along the lines of

error: no such subcommand: `foo`

        Did you mean `doc`?

Given that we can have the full list crates available to us, we can detect that a user is trying to use a not-yet-installed subcommand.

Proposed Solution

No response

Notes

No response

@estebank estebank added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Oct 12, 2022
@weihanglo
Copy link
Member

weihanglo commented Oct 12, 2022

Given that we can have the full list crates available to us, we can detect that a user is trying to use a not-yet-installed subcommand.

Mind that the precondition might not be fulfilled when the sparse-registry becomes the default in the future, unless we address it with a solution like #10928.

@epage
Copy link
Contributor

epage commented Oct 12, 2022

btw some recent improvements around "no such command" was done in #10924

@weihanglo weihanglo added A-diagnostics Area: Error and warning messages generated by Cargo itself. A-custom-subcommands Area: custom 3rd party subcommand plugins labels Oct 12, 2022
@epage
Copy link
Contributor

epage commented Oct 12, 2022

Until we have a full list of crates, we could potentially check the registry specifically for cargo-foo but

  • We would want to do this offline as it would be surprising to reach out over the network
  • Sparse registry only caches locally what you use which would make offline checking for cargo-foo very limited

@epage
Copy link
Contributor

epage commented Oct 12, 2022

Would it be worthwhile to always add a suggestion To install the command, run 'cargo install cargo-foo' until we can show it only when needed?

I lean towards "no" but thought it worth bringing up.

@weihanglo
Copy link
Member

If Cargo found a crate with the exact name, but it were a malicious/low-quality/abandoned crate, should Cargo recommend it?

@epage
Copy link
Contributor

epage commented Oct 12, 2022

Was going to respond but I finally found the issue is this is a duplicate of (I knew I had seen this before).

Closing in favor of #4682, let's continue the discussion there.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-custom-subcommands Area: custom 3rd party subcommand plugins 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

3 participants