You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cargo should give helpful errors when unsupported flags are used. #11702
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:
@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?
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.
Not sure if this is the relevant clap issue clap-rs/clap#4853. Supposed we are going to leverage UnknownArgumentValueParser for those well-known unknown arguments, it might cause unwanted typo suggestion for them.
Let me label it blocked on that issue at this moment.
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 cargo test --keep-going. If the user thought it should work and did cargo test --keep-goign, today they would get a correction and then be pointed to the correct flag (yes, ideally the two steps would be one step which might be a consideration where suggest_arg is appropriate). With the proposed change, the user would just get an unexpected argument error and would fall back to --help. Trying to understand which path is best.
It's not inherently bad, and agree with that two steps is better than infinite steps searching in --help. Just it is lying that “a similar argument exists”, which doesn't.
I am convinced that it's not really a blocker 😆. Would be great if clap can improve the situation.
Activity
weihanglo commentedon Feb 13, 2023
Does it make sense having this as a built-in mechanism in clap for suggesting an alternative flag?
epage commentedon Feb 13, 2023
@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?
weihanglo commentedon Apr 21, 2023
More examples:
--debugforcargo build. Only--release.--releaseforcargo install. Only--debug.These does confuse people a lot. See #12009.
weihanglo commentedon Apr 21, 2023
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
weihanglo commentedon Aug 17, 2023
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
weihanglo commentedon Aug 22, 2023
Not sure if this is the relevant clap issue clap-rs/clap#4853. Supposed we are going to leverage
UnknownArgumentValueParserfor those well-known unknown arguments, it might cause unwanted typo suggestion for them.Let me label it blocked on that issue at this moment.
@rustbot label -S-accepted +S-blocked-external
epage commentedon Aug 22, 2023
@weihanglo could you give an example of where that causes a problem worth blocking this issue?
weihanglo commentedon Aug 22, 2023
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.
epage commentedon Aug 23, 2023
Asking to better characterize the problem: is that always bad though?
Take the prior work in #12529, like
cargo test --keep-going. If the user thought it should work and didcargo test --keep-goign, today they would get a correction and then be pointed to the correct flag (yes, ideally the two steps would be one step which might be a consideration wheresuggest_argis appropriate). With the proposed change, the user would just get anunexpected argumenterror and would fall back to--help. Trying to understand which path is best.weihanglo commentedon Aug 23, 2023
It's not inherently bad, and agree with that two steps is better than infinite steps searching in
--help. Just it is lying that “a similar argument exists”, which doesn't.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
0xPoe commentedon Sep 19, 2023
@rustbot claim