diff --git a/build.rs b/build.rs index 2dc9612..66f6c87 100644 --- a/build.rs +++ b/build.rs @@ -1,18 +1,15 @@ -#[cfg(feature = "cli")] -use clap::CommandFactory; -#[cfg(feature = "cli")] -use clap_complete::{generate_to, Shell}; -#[cfg(feature = "cli")] -use std::env; - #[cfg(feature = "cli")] include!("src/cli.rs"); #[cfg(feature = "cli")] fn main() -> Result<(), clap::Error> { - let outdir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("completions/"); + use clap::CommandFactory; + use clap_complete::{generate_to, Shell}; + use std::{env, fs, path}; + + let outdir = path::Path::new(env!("CARGO_MANIFEST_DIR")).join("completions/"); if !outdir.exists() { - std::fs::create_dir(outdir.clone()).expect("Failed to create 'completions' directory."); + fs::create_dir(outdir.clone()).expect("Failed to create 'completions' directory."); } let mut cmd = Opt::command();