-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
36 lines (31 loc) · 1.03 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::process::Command;
pub fn main() {
let shuf_command = "shuf";
let tldr_command = "tldr";
// check for shuf command
let result = Command::new("bash")
.arg("-c")
.arg(format!("which {}", shuf_command))
.output()
.expect("failed to execute bash command");
if !result.status.success() {
println!(
r#"cargo:warning={} is not installed. To install it (on osx) run "brew install coreutils""#,
shuf_command
);
panic!("Failed to build executable due to missing tldr command");
}
// check for tldr command
let result = Command::new("bash")
.arg("-c")
.arg(format!("which {}", tldr_command))
.output()
.expect("failed to execute bash command");
if !result.status.success() {
println!(
r#"cargo:warning={} is not installed. To install it run "cargo install tealdeer""#,
tldr_command
);
panic!("Failed to build executable due to missing tldr command");
}
}