pages-server/build.rs

29 lines
1 KiB
Rust
Raw Normal View History

2022-07-15 21:55:31 +00:00
// This file is part of the "lamp" program.
// Copyright (C) 2022 crapStone
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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
}