mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
fix(help): Show subcommand flags in same order as usage
This commit is contained in:
parent
86864b004b
commit
8c5e42e0fb
2 changed files with 3 additions and 3 deletions
|
@ -49,9 +49,9 @@ OPTIONS:
|
|||
-V, --version Print version information
|
||||
|
||||
SUBCOMMANDS:
|
||||
-Q--queryquery Query the package database.
|
||||
-S--syncsync Synchronize packages.
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
query-Q--query Query the package database.
|
||||
sync-S--sync Synchronize packages.
|
||||
|
||||
$ pacman -S -h
|
||||
pacman[EXE]-sync
|
||||
|
|
|
@ -844,13 +844,13 @@ impl<'help, 'app, 'writer> Help<'help, 'app, 'writer> {
|
|||
.filter(|subcommand| should_show_subcommand(subcommand))
|
||||
{
|
||||
let mut sc_str = String::new();
|
||||
sc_str.push_str(subcommand.get_name());
|
||||
if let Some(short) = subcommand.get_short_flag() {
|
||||
write!(sc_str, "-{}", short).unwrap();
|
||||
}
|
||||
if let Some(long) = subcommand.get_long_flag() {
|
||||
write!(sc_str, "--{}", long).unwrap();
|
||||
}
|
||||
sc_str.push_str(subcommand.get_name());
|
||||
longest = longest.max(display_width(&sc_str));
|
||||
ord_v.push((subcommand.get_display_order(), sc_str, subcommand));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue