Skip to content

Commit 76705ed

Browse files
committed
Prevent clap from interspersing global and subcommand args
clap-rs/clap#4920
1 parent 5cedce9 commit 76705ed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/bin/cargo/cli.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ pub fn cli() -> Command {
440440
"cargo [OPTIONS] [COMMAND]"
441441
};
442442
Command::new("cargo")
443+
// Subcommands all count their args' display order independently (from 0),
444+
// which makes their args interspersed with global args. This puts global args last.
445+
.next_display_order(1000)
443446
.allow_external_subcommands(true)
444447
// Doesn't mix well with our list of common cargo commands. See clap-rs/clap#3108 for
445448
// opening clap up to allow us to style our help template

0 commit comments

Comments
 (0)