Handling of command line arguments with 1.38.0

As far as I can tell, this regression occurred due to some... odd design choices of clap regarding how .takes_value() and .multiple() interact, and should be fixed on the latest (or upcoming) nightly.


# this always worked
cargo run --features a,b

# support for this was added
cargo run --features a --features b

# support for this was also (unintentionally) added,
# hence the regression
cargo run --features a b

# This is also apparently the same.
# Why does --features have both space and commas as delimiters?
# I dunno. Blame clap.
cargo run --features "a b"

The presence or absence of quotes is irrelevant unless your feature name contains shell metacharacters. On UNIX, they are interpreted by the shell and never even seen by the program. On Windows where the raw command line string is provided to binaries, the Rust standard library parses the command line string into arguments when you use std::env::{args, args_os}, again handling the quotes before they are seen by something like cargo.

2 Likes