-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo should give helpful errors when unsupported flags are used. #11702
Comments
Does it make sense having this as a built-in mechanism in clap for suggesting an alternative flag? |
@weihanglo I think that can make sense to seed clap with specific suggestions and not just rely on the automatic suggestions and that would help simplify things for application, like cargo. Mind opening an issue? |
More examples:
These does confuse people a lot. See #12009. |
I am not sure if we should wait for upstream fix or make our own custom suggestion. Let's label it as waiting for upstream first. We still seek ad-hoc solutions if somebody is interested in. @rustbot label +S-blocked-external |
clap-rs/clap#5075 just got landed with clap@4.3.22. People, we now can have basic suggestions for unsupported arguments! I'll write down a list of flags of interest and instructions shortly. @rustbot label -S-blocked-external +S-accepted +E-easy |
Not sure if this is the relevant clap issue clap-rs/clap#4853. Supposed we are going to leverage Let me label it blocked on that issue at this moment. @rustbot label -S-accepted +S-blocked-external |
@weihanglo could you give an example of where that causes a problem worth blocking this issue? |
Something like this? Though for short aliases clap doesn't suggest them I feel like. If that's the case we can continue working on short aliases part. Finished dev [unoptimized + debuginfo] target(s) in 0.16s
Running `target/debug/cargo install --please`
error: unexpected argument '--please' found
tip: a similar argument exists: '--release'
Usage: cargo install --release [crate]...
For more information, try '--help'. |
Asking to better characterize the problem: is that always bad though? Take the prior work in #12529, like |
It's not inherently bad, and agree with that two steps is better than infinite steps searching in I am convinced that it's not really a blocker 😆. Would be great if clap can improve the situation. @rustbot label +S-accepted -S-blocked-external |
@rustbot claim |
Problem
There are several flags one might imagine users passing to Cargo that aren't supported yet. It'd be nice if we told users who try to use these what to use instead, and perhaps also linked to the issue (if any) proposing to add such a flag. Some examples:
-C
for running in a different directory. (blocked oncargo -C dir
does not use therust-toolchain.toml
file within the given directory. #11957)-w
or-W
short for--workspace
(except inupdate
, blocked on Add short flag-w
for--workspace
#11554).-x
for--exclude
Add unsupported short flag suggestion for--target
and--exclude
flags #12805-t
for--target
Add unsupported short flag suggestion for--target
and--exclude
flags #12805-s
for--quiet
(-s
is "silent" incurl
) Add better suggestion for the unsupported silent flag #12723--manifest-path
, not--path
(though there is--path
forcargo add
)-c
for--config
Add test for unsupported short config flag #12777-z
, only-Z
Add unsupported lowercase-z
flag suggestion for-Z
flag #12788-O
, only--out-dir
Add unsupported short suggestion for --out-dir flag #12755-n
for--dry-run
feat(cli): Add '-n' to dry-run #12660Proposed Solution
No response
Notes
No response
The text was updated successfully, but these errors were encountered: