mirror of
https://github.com/lsd-rs/lsd
synced 2025-03-04 15:07:12 +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
21
build.rs
21
build.rs
|
@ -12,26 +12,21 @@ extern crate version_check;
|
||||||
|
|
||||||
use clap::Shell;
|
use clap::Shell;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, Write};
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
include!("src/app.rs");
|
include!("src/app.rs");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match version_check::is_min_version("1.62.0") {
|
// rustc version too small or can't figure it out
|
||||||
Some(true) => {}
|
if version_check::is_min_version("1.62.0") != Some(true) {
|
||||||
// rustc version too small or can't figure it out
|
eprintln!("'lsd' requires rustc >= 1.62.0");
|
||||||
_ => {
|
exit(1);
|
||||||
writeln!(&mut io::stderr(), "'lsd' requires rustc >= 1.62.0").unwrap();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR"));
|
let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR")
|
||||||
let outdir = match var {
|
.or_else(|| std::env::var_os("OUT_DIR"))
|
||||||
None => return,
|
.unwrap_or_else(|| exit(0));
|
||||||
Some(outdir) => outdir,
|
|
||||||
};
|
|
||||||
fs::create_dir_all(&outdir).unwrap();
|
fs::create_dir_all(&outdir).unwrap();
|
||||||
|
|
||||||
let mut app = build();
|
let mut app = build();
|
||||||
|
|
Loading…
Add table
Reference in a new issue