From ed542df9bc798bbdfe4d18308b9a6528bebf0461 Mon Sep 17 00:00:00 2001 From: Smitty Date: Sat, 9 Jul 2022 18:52:37 -0400 Subject: [PATCH] Fix binary name in help message for test binaries --- library/test/src/cli.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/test/src/cli.rs b/library/test/src/cli.rs index 000f5fa3f58..f981b9c4954 100644 --- a/library/test/src/cli.rs +++ b/library/test/src/cli.rs @@ -196,6 +196,7 @@ fn usage(binary: &str, options: &getopts::Options) { pub fn parse_opts(args: &[String]) -> Option { // Parse matches. let opts = optgroups(); + let binary = args.get(0).map(|c| &**c).unwrap_or("..."); let args = args.get(1..).unwrap_or(args); let matches = match opts.parse(args) { Ok(m) => m, @@ -205,7 +206,7 @@ pub fn parse_opts(args: &[String]) -> Option { // Check if help was requested. if matches.opt_present("h") { // Show help and do nothing more. - usage(&args[0], &opts); + usage(binary, &opts); return None; } -- 2.44.0