pages-server/build.rs

24 lines
809 B
Rust
Raw Normal View History

2022-07-15 21:34:09 +00:00
use std::{path::PathBuf, io::Error};
use clap_complete::{generate_to, shells, Generator};
2020-07-22 16:47:26 +00:00
include!("src/cli.rs");
2022-07-15 21:34:09 +00:00
fn main() -> Result<(), Error> {
let outdir = "completions";
let mut cmd = build_cli();
let path = generate_completions(shells::Bash, &mut cmd, outdir)?;
println!("cargo:debug=completion file is generated: {:?}", path);
let path = generate_completions(shells::Zsh, &mut cmd, outdir)?;
println!("cargo:debug=completion file is generated: {:?}", path);
let path = generate_completions(shells::Fish, &mut cmd, outdir)?;
println!("cargo:debug=completion file is generated: {:?}", path);
Ok(())
}
fn generate_completions<G: Generator>(shell: G, cmd: &mut clap::Command, outdir: &str) -> Result<PathBuf, Error> {
generate_to(shell, cmd, "lamp", outdir)
2020-07-22 16:47:26 +00:00
}