Skip to content

Commit 21aba21

Browse files
authored
Merge pull request #206 from Alexendoo/fix-cli
Fix the CLI requiring the help argument
2 parents 35467b8 + 7dd275f commit 21aba21

File tree

13 files changed

+34
-11
lines changed

13 files changed

+34
-11
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
- name: Verify that binary works
3232
run: |
3333
cargo run -- bisect-rustc --help | grep "EXAMPLES:"
34-
cargo run -- --help | grep "EXAMPLES:"
34+
cargo run -- --help | grep "SUBCOMMANDS:"

src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ const REPORT_HEADER: &str = "\
5757
==================================================================================";
5858

5959
#[derive(Debug, Parser)]
60-
#[clap(
61-
bin_name = "cargo",
62-
disable_help_flag = true,
63-
subcommand_required = true
64-
)]
60+
#[clap(bin_name = "cargo", subcommand_required = true)]
6561
enum Cargo {
6662
BisectRustc(Opts),
6763
}
@@ -85,9 +81,6 @@ enum Cargo {
8581
)]
8682
#[allow(clippy::struct_excessive_bools)]
8783
struct Opts {
88-
#[clap(long, short, action = clap::builder::ArgAction::Help, help = "Print help information")]
89-
help: bool,
90-
9184
#[clap(
9285
long,
9386
help = "Custom regression definition",

tests/cmd/bare-h.stdout

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cargo-bisect-rustc
2+
3+
USAGE:
4+
cargo <SUBCOMMAND>
5+
6+
OPTIONS:
7+
-h, --help Print help information
8+
9+
SUBCOMMANDS:
10+
bisect-rustc Bisects rustc toolchains with rustup
11+
help Print this message or the help of the given subcommand(s)

tests/cmd/bare-h.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin.name = "cargo-bisect-rustc"
2+
args = "-h"

tests/cmd/bare-help.stderr

Whitespace-only changes.

tests/cmd/bare-help.stdout

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cargo-bisect-rustc
2+
3+
USAGE:
4+
cargo <SUBCOMMAND>
5+
6+
OPTIONS:
7+
-h, --help Print help information
8+
9+
SUBCOMMANDS:
10+
bisect-rustc Bisects rustc toolchains with rustup
11+
help Print this message or the help of the given subcommand(s)

tests/cmd/bare-help.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin.name = "cargo-bisect-rustc"
2+
args = "--help"

tests/cmd/h.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
bin.name = "cargo-bisect-rustc"
2-
args = "-h"
2+
args = "bisect-rustc -h"

tests/cmd/help.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
bin.name = "cargo-bisect-rustc"
2-
args = "--help"
2+
args = "bisect-rustc --help"

0 commit comments

Comments
 (0)