mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-01-19 08:57:55 +00:00
28 lines
1 KiB
Rust
28 lines
1 KiB
Rust
// 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/>.
|
|
|
|
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)
|
|
}
|