mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 21:52:37 +00:00
refactor(build): make code more modern and idiomatic
This commit is contained in:
parent
0a7e6e7f47
commit
34da1409c3
1 changed files with 8 additions and 13 deletions
17
build.rs
17
build.rs
|
@ -12,26 +12,21 @@ extern crate version_check;
|
|||
|
||||
use clap::Shell;
|
||||
use std::fs;
|
||||
use std::io::{self, Write};
|
||||
use std::process::exit;
|
||||
|
||||
include!("src/app.rs");
|
||||
|
||||
fn main() {
|
||||
match version_check::is_min_version("1.62.0") {
|
||||
Some(true) => {}
|
||||
// rustc version too small or can't figure it out
|
||||
_ => {
|
||||
writeln!(&mut io::stderr(), "'lsd' requires rustc >= 1.62.0").unwrap();
|
||||
if version_check::is_min_version("1.62.0") != Some(true) {
|
||||
eprintln!("'lsd' requires rustc >= 1.62.0");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR"));
|
||||
let outdir = match var {
|
||||
None => return,
|
||||
Some(outdir) => outdir,
|
||||
};
|
||||
let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR")
|
||||
.or_else(|| std::env::var_os("OUT_DIR"))
|
||||
.unwrap_or_else(|| exit(0));
|
||||
|
||||
fs::create_dir_all(&outdir).unwrap();
|
||||
|
||||
let mut app = build();
|
||||
|
|
Loading…
Reference in a new issue