Skip to content

Commit 928fcc7

Browse files
committed
Fix open is macOS specific
1 parent fb7d3e6 commit 928fcc7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/cli/src/help.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ fn dim(input: &str) -> String {
66
}
77

88
pub fn usage() -> String {
9+
#[cfg(target_os = "macos")]
10+
let open = "open";
11+
#[cfg(windows)]
12+
let open = "foo";
13+
#[cfg(target_os = "linux")]
14+
let open = "xdg-open";
15+
916
let usage = r##"
1017
usage:
1118
pkgx [[email protected]…] <program|path> [--] [arg…]
@@ -24,7 +31,7 @@ flags:
2431
-v, --version
2532
2633
more:
27-
$ open https://docs.pkgx.sh
34+
$ OPEN https://docs.pkgx.sh
2835
"##;
2936

3037
let usage = usage
@@ -33,7 +40,8 @@ more:
3340
.replace('<', &dim("<"))
3441
.replace('>', &dim(">"))
3542
.replace('$', &dim("$"))
36-
.replace('|', &dim("|"));
43+
.replace('|', &dim("|"))
44+
.replace("OPEN", open);
3745

3846
let re = Regex::new("(?m) #.*$").unwrap();
3947

0 commit comments

Comments
 (0)