Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the CLI requiring the help argument #206

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Verify that binary works
run: |
cargo run -- bisect-rustc --help | grep "EXAMPLES:"
cargo run -- --help | grep "EXAMPLES:"
cargo run -- --help | grep "SUBCOMMANDS:"
9 changes: 1 addition & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ const REPORT_HEADER: &str = "\
==================================================================================";

#[derive(Debug, Parser)]
#[clap(
bin_name = "cargo",
disable_help_flag = true,
subcommand_required = true
)]
#[clap(bin_name = "cargo", subcommand_required = true)]
enum Cargo {
BisectRustc(Opts),
}
Expand All @@ -85,9 +81,6 @@ enum Cargo {
)]
#[allow(clippy::struct_excessive_bools)]
struct Opts {
#[clap(long, short, action = clap::builder::ArgAction::Help, help = "Print help information")]
help: bool,

#[clap(
long,
help = "Custom regression definition",
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/cmd/bare-h.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cargo-bisect-rustc

USAGE:
cargo <SUBCOMMAND>

OPTIONS:
-h, --help Print help information

SUBCOMMANDS:
bisect-rustc Bisects rustc toolchains with rustup
help Print this message or the help of the given subcommand(s)
2 changes: 2 additions & 0 deletions tests/cmd/bare-h.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.name = "cargo-bisect-rustc"
args = "-h"
Empty file added tests/cmd/bare-help.stderr
Empty file.
11 changes: 11 additions & 0 deletions tests/cmd/bare-help.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cargo-bisect-rustc

USAGE:
cargo <SUBCOMMAND>

OPTIONS:
-h, --help Print help information

SUBCOMMANDS:
bisect-rustc Bisects rustc toolchains with rustup
help Print this message or the help of the given subcommand(s)
2 changes: 2 additions & 0 deletions tests/cmd/bare-help.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.name = "cargo-bisect-rustc"
args = "--help"
2 changes: 1 addition & 1 deletion tests/cmd/h.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bin.name = "cargo-bisect-rustc"
args = "-h"
args = "bisect-rustc -h"
2 changes: 1 addition & 1 deletion tests/cmd/help.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bin.name = "cargo-bisect-rustc"
args = "--help"
args = "bisect-rustc --help"
oli-obk marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions tests/cmd/start-in-future.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERROR: start date must be on or before the current date. received start date request 9999-01-01UTC
Empty file.
3 changes: 3 additions & 0 deletions tests/cmd/start-in-future.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin.name = "cargo-bisect-rustc"
args = "--start 9999-01-01"
status = "failed"