Skip to content

Commit

Permalink
package: move destination of shell completion files
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelohdez committed Feb 19, 2024
1 parent c358319 commit 7cc0a01
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use std::{fs, io::Result, path::PathBuf};
use std::{env, io::Result};

use clap::CommandFactory;
use clap::{CommandFactory, ValueEnum};
use clap_complete::{generate_to, Shell};

include!("src/cli.rs");

fn main() -> Result<()> {
let mut cli = Atmpt::command();

let dir = PathBuf::from("completions");
if !dir.is_dir() {
fs::create_dir(&dir)?;
}
let dir = match env::var_os("OUT_DIR") {
None => return Ok(()),
Some(dir) => dir,
};

for shell in [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell] {
for &shell in Shell::value_variants() {
let comp_file = generate_to(shell, &mut cli, "atmpt", &dir)?;
println!("cargo:warning=generated completion for {shell}: {comp_file:?}");
}
Expand Down

0 comments on commit 7cc0a01

Please sign in to comment.