Skip to content

Commit 59eb325

Browse files
committed
fix: avoid "stg.exe" in usage on Windows
The clap-generated usage lines in help output use the command's "bin name". On Windows, the bin name has a ".exe" extension. All of StGit's man pages and custom usage lines use "stg" without any extension. Insofar as .exe extensions can be elided on Windows when running executables, plain "stg" is valid on all platforms. So we set the bin name to "stg" to maintain consistency in usage statements across StGit subcommands and across target platforms.
1 parent 96dd43a commit 59eb325

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const CONFLICT_ERROR: i32 = 3;
5050
/// [`clap::Command`] graph as needed to execute the target subcommand; avoiding the
5151
/// cost of instantiating [`clap::Command`] instances for every StGit subcommand.
5252
fn get_base_command(color_choice: Option<termcolor::ColorChoice>) -> clap::Command {
53-
let command = clap::Command::new("stg")
53+
let mut command = clap::Command::new("stg")
5454
.about("Maintain a stack of patches on top of a Git branch.")
5555
.override_usage(cmd::make_usage(
5656
"stg",
@@ -90,6 +90,10 @@ fn get_base_command(color_choice: Option<termcolor::ColorChoice>) -> clap::Comma
9090
.value_hint(clap::ValueHint::AnyPath),
9191
)
9292
.arg(color::get_color_arg().global(true).display_order(998));
93+
94+
// Ensure "stg" and not "stg.exe" shows up in usage on Windows.
95+
command.set_bin_name("stg");
96+
9397
if let Some(color_choice) = color_choice {
9498
command.color(color::termcolor_choice_to_clap(color_choice))
9599
} else {

0 commit comments

Comments
 (0)