Skip to content

Commit

Permalink
fix: windows support
Browse files Browse the repository at this point in the history
The executable suffix is unconditionally stripped off the file path
so that the file name matches subcommands names
without having to add the EXE suffix on different platforms.
  • Loading branch information
fishface60 committed Dec 11, 2021
1 parent 494b733 commit 1b60a38
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions examples/multicall_busybox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ See the documentation for clap::AppSettings::Multicall for rationale.

This example omits every command except true and false,
which are the most trivial to implement,
```bash,ignore
```bash
$ busybox true
? 0
$ busybox false
Expand All @@ -16,20 +16,20 @@ $ busybox false

But includes the `--install` option as an example of why it can be useful
for the main program to take arguments that aren't applet subcommands.
```bash,ignore
```bash
$ busybox --install
? failed
...
```

Though users must pass something:
```bash,ignore
```bash
$ busybox
? failed
busybox

USAGE:
busybox[EXE] [OPTIONS] [APPLET]
busybox [OPTIONS] [APPLET]

OPTIONS:
-h, --help Print help information
Expand Down
2 changes: 1 addition & 1 deletion examples/multicall_hostname.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ See the documentation for clap::AppSettings::Multicall for rationale.

This example omits the implementation of displaying address config

```bash,ignore
```bash
$ hostname
www
```
Expand Down
2 changes: 1 addition & 1 deletion src/build/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ impl<'help> App<'help> {
if self.settings.is_set(AppSettings::Multicall) {
if let Some((argv0, _)) = it.next() {
let argv0 = Path::new(&argv0);
if let Some(command) = argv0.file_name().and_then(|f| f.to_str()) {
if let Some(command) = argv0.file_stem().and_then(|f| f.to_str()) {
// Stop borrowing command so we can get another mut ref to it.
let command = command.to_owned();
debug!(
Expand Down

0 comments on commit 1b60a38

Please sign in to comment.