]> git.proxmox.com Git - cargo.git/commit - src/bin/cargo/commands/rustc.rs
Fix a regression with parsing multivalue options
authorAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 16 Mar 2018 14:35:13 +0000 (17:35 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 16 Mar 2018 14:35:13 +0000 (17:35 +0300)
commit70ff33a5378407021e3e496d01d72156f775c30f
tree119809b9f5b5336dd8d1d9bf4c641625bda3f0ca
parent182226ec49d9cd4ce4f041ee7a10dcaa442e704a
Fix a regression with parsing multivalue options

By default, clap interprets

```
cargo run --bin foo bar baz
```

as

```
cargo run --bin foo --bin bar --bin baz
```

This behavior is different from docopt and does not play nicely with
positional arguments at all. Luckily, clap has a flag to get the
behavior we want, it just not the default! It will become the default in
the next version of clap, but, until that time, we should be careful
when using the combination of `.long`, `.value_name` and
`.multiple(true)`, and don't forget to specify `.number_of_values(1)` as
well.
16 files changed:
src/bin/cli.rs
src/bin/command_prelude.rs
src/bin/commands/bench.rs
src/bin/commands/build.rs
src/bin/commands/check.rs
src/bin/commands/clean.rs
src/bin/commands/doc.rs
src/bin/commands/owner.rs
src/bin/commands/pkgid.rs
src/bin/commands/run.rs
src/bin/commands/rustc.rs
src/bin/commands/rustdoc.rs
src/bin/commands/test.rs
src/bin/commands/uninstall.rs
src/bin/commands/update.rs
tests/testsuite/run.rs