clap is overeager eating `+toolchain` positional
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Problem
The clap CLI parser is overeager at eating a positional argument to fill the +toolchain field when it's not actually appropriate, this can lead to very confusing interactions. Consider:
Steps
- run
rustup add target(braino swappedtargetandadd) and be told about thelistsubcommand. - run
rustup add target listthinking maybe that'll tell you what targets you can add and get the unexpected errorerror: Invalid value for '<+toolchain>': Toolchain overrides must begin with '+'
Possible Solution(s)
We probably want to detect, consume, and remove from the argv the +toolchain argument and then not have it as part of clap, unless we can teach clap to ignore a positional which doesn't match +toolchain somehow
Notes
This is using master at 53b2168fa6426ea3cb3099be6049aa7e04ed4a6e
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two rustup command examples and trace how the CLI argument handling passes positional values to clap's +toolchain field. Done means positional arguments that do not begin with '+' are not reported as invalid toolchain overrides, while the intended subcommand guidance or behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100