"Fossies" - the Fresh Open Source Software Archive

Member "fd-8.1.1/build.rs" (25 May 2020, 844 Bytes) of package /linux/privat/fd-8.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Rust source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "build.rs": 7.5.0_vs_8.0.0.

    1 use std::fs;
    2 
    3 use clap::Shell;
    4 
    5 include!("src/app.rs");
    6 
    7 fn main() {
    8     let min_version = "1.36";
    9 
   10     match version_check::is_min_version(min_version) {
   11         Some(true) => {}
   12         // rustc version too small or can't figure it out
   13         _ => {
   14             eprintln!("'fd' requires rustc >= {}", min_version);
   15             std::process::exit(1);
   16         }
   17     }
   18 
   19     let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));
   20     let outdir = match var {
   21         None => return,
   22         Some(outdir) => outdir,
   23     };
   24     fs::create_dir_all(&outdir).unwrap();
   25 
   26     let mut app = build_app();
   27     app.gen_completions("fd", Shell::Bash, &outdir);
   28     app.gen_completions("fd", Shell::Fish, &outdir);
   29     app.gen_completions("fd", Shell::Zsh, &outdir);
   30     app.gen_completions("fd", Shell::PowerShell, &outdir);
   31 }