Skip to content

Commit 1679125

Browse files
committed
docs: clarify reason for not using clap or structopt in argument parsing
1 parent 8af9f59 commit 1679125

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

go-runner/src/cli.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ impl Cli {
4343
}
4444
}
4545

46+
/// Parses the command-line arguments into a Cli instance.
47+
///
48+
/// # Why not use clap or structopt?
49+
///
50+
/// Unfortunately `go test` supports arguments with a different syntax than those crates. For
51+
/// example, `-bench` and `-benchtime` use single dashes instead of double dashes.
52+
///
53+
/// We can't do this with clap/structopt, because they only support single dashes for single-letter
54+
/// flags (e.g., `-h`), and double dashes for multi-letter flags (e.g., `--help`).
4655
fn parse_args(mut args: impl Iterator<Item = String>) -> Result<Self, CliExit> {
4756
let mut instance = Self::default();
4857

0 commit comments

Comments
 (0)