mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-01-19 08:57:55 +00:00
23 lines
809 B
Rust
23 lines
809 B
Rust
use std::{path::PathBuf, io::Error};
|
|
|
|
use clap_complete::{generate_to, shells, Generator};
|
|
|
|
include!("src/cli.rs");
|
|
|
|
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)
|
|
}
|