Skip to content

Commit 659b8a0

Browse files
committed
open application now reads OPEN_WITH environment variable to obtain the program to open with. (#80)
This is helpful when testing new features around the `with()` function.
1 parent b4592a4 commit 659b8a0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ fn main() {
99
}
1010
};
1111

12-
match open::that(&path_or_url) {
12+
let result = match std::env::var("OPEN_WITH").ok() {
13+
Some(program) => open::with(&path_or_url, program),
14+
None => open::that(&path_or_url),
15+
};
16+
17+
match result {
1318
Ok(()) => println!("Opened '{}' successfully.", path_or_url),
1419
Err(err) => {
1520
eprintln!("An error occurred when opening '{}': {}", path_or_url, err);

0 commit comments

Comments
 (0)