From 3475555de637167390c8a33ad14b08376c602b57 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 14 Feb 2022 16:22:59 -0600 Subject: [PATCH] fix(help): Use standard alternate syntax for subcommands --- examples/pacman.md | 4 ++-- src/build/app.rs | 4 ++-- tests/builder/flag_subcommands.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/pacman.md b/examples/pacman.md index 225b6dd4476..7f6c5a7d339 100644 --- a/examples/pacman.md +++ b/examples/pacman.md @@ -58,7 +58,7 @@ pacman[EXE]-sync Synchronize packages. USAGE: - pacman[EXE] {sync, --sync, -S} [OPTIONS] [--] [package]... + pacman[EXE] {sync|--sync|-S} [OPTIONS] [--] [package]... ARGS: ... packages @@ -77,7 +77,7 @@ $ pacman -S -s foo -i bar error: The argument '--search ...' cannot be used with '--info' USAGE: - pacman[EXE] {sync, --sync, -S} --search ... ... + pacman[EXE] {sync|--sync|-S} --search ... ... For more information try --help diff --git a/src/build/app.rs b/src/build/app.rs index 5f435ec415c..bcc36ea2d4d 100644 --- a/src/build/app.rs +++ b/src/build/app.rs @@ -4003,11 +4003,11 @@ impl<'help> App<'help> { let mut sc_names = sc.name.clone(); let mut flag_subcmd = false; if let Some(l) = sc.long_flag { - write!(sc_names, ", --{}", l).unwrap(); + write!(sc_names, "|--{}", l).unwrap(); flag_subcmd = true; } if let Some(s) = sc.short_flag { - write!(sc_names, ", -{}", s).unwrap(); + write!(sc_names, "|-{}", s).unwrap(); flag_subcmd = true; } diff --git a/tests/builder/flag_subcommands.rs b/tests/builder/flag_subcommands.rs index 9decadfda71..fc1b1c2bc95 100644 --- a/tests/builder/flag_subcommands.rs +++ b/tests/builder/flag_subcommands.rs @@ -453,7 +453,7 @@ static FLAG_SUBCOMMAND_HELP: &str = "pacman-query Query the package database. USAGE: - pacman {query, --query, -Q} [OPTIONS] + pacman {query|--query|-Q} [OPTIONS] OPTIONS: -h, --help Print help information @@ -507,7 +507,7 @@ static FLAG_SUBCOMMAND_NO_SHORT_HELP: &str = "pacman-query Query the package database. USAGE: - pacman {query, --query} [OPTIONS] + pacman {query|--query} [OPTIONS] OPTIONS: -h, --help Print help information @@ -560,7 +560,7 @@ static FLAG_SUBCOMMAND_NO_LONG_HELP: &str = "pacman-query Query the package database. USAGE: - pacman {query, -Q} [OPTIONS] + pacman {query|-Q} [OPTIONS] OPTIONS: -h, --help Print help information