lsd/build.rs
Fabio Valentini dee06211ab
update various dependencies (#938)
I'm the maintainer of lsd for Fedora Linux, and some outdated
dependencies are making maintenance increasingly difficult.

- deps: update chrono-humanize to v0.2

We have this patched for almost two years in Fedora and it has not
caused issues.

- deps: update assert_cmd to v2

Same here, this patch has been in the Fedora package for a while.

- deps: update sys-locale to v0.3

This dependency seems to have been added recently, not sure why an old
version was chosen.

- deps: update vsort to v0.2

Same here, this was added recently but 0.1 was used instead of 0.2, not
sure why.

- deps: update git2 to v0.18

Using old versions of git2 is not a good idea, since the bundled libgit2
C library often has CVE issues.

- deps: migrate from users to uzers

The "users" crate is unmaintained. The "uzers" crate is an
API-compatible fork that also fixes some bugs and security issues.

- deps: update serial_test to v2

The current dependency (v0.5) is **reeeeeally** old. Not sure why this
was never updated.

- deps: update predicates to v3

Same here, predicates v1 is **reaally** old.

- deps: allow newer versions of url, wild, and xdg crates

Not sure why strange `x.0.*` style dependencies were used here. It's
holding back various updates for both url and xdg crates, and makes
maintaining lsd in Fedora more difficult. We have built lsd against the
latest versions of all three crates forever, and it has not caused
issues.
2023-12-20 11:44:20 +08:00

42 lines
1.5 KiB
Rust

// Copyright (c) 2017 fd developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0>
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
use clap::CommandFactory;
use clap_complete::generate_to;
use clap_complete::shells::*;
use std::fs;
use std::process::exit;
include!("src/app.rs");
fn main() {
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 = Cli::command();
let bin_name = "lsd";
generate_to(Bash, &mut app, bin_name, &outdir).expect("Failed to generate Bash completions");
generate_to(Fish, &mut app, bin_name, &outdir).expect("Failed to generate Fish completions");
generate_to(Zsh, &mut app, bin_name, &outdir).expect("Failed to generate Zsh completions");
generate_to(PowerShell, &mut app, bin_name, &outdir)
.expect("Failed to generate PowerShell completions");
// Disable git feature for these target where git2 is not well supported
if !std::env::var("CARGO_FEATURE_GIT2")
.map(|flag| flag == "1")
.unwrap_or(false)
|| std::env::var("TARGET")
.map(|target| target == "i686-pc-windows-gnu")
.unwrap_or(false)
{
println!(r#"cargo:rustc-cfg=feature="no-git""#);
}
}