mirror of
https://github.com/chmln/sd
synced 2024-11-26 04:50:22 +00:00
20 lines
521 B
Rust
20 lines
521 B
Rust
include!("src/app.rs");
|
|
|
|
fn main() {
|
|
use std::{env::var, fs, str::FromStr};
|
|
use structopt::clap::Shell;
|
|
|
|
let mut app = Options::clap();
|
|
let out_dir = var("SHELL_COMPLETIONS_DIR").or(var("OUT_DIR")).unwrap();
|
|
let bin_name = var("CARGO_PKG_NAME").unwrap();
|
|
|
|
fs::create_dir_all(&out_dir).unwrap();
|
|
|
|
Shell::variants().into_iter().for_each(|shell| {
|
|
app.gen_completions(
|
|
bin_name.as_ref(),
|
|
Shell::from_str(shell).unwrap(),
|
|
&out_dir,
|
|
);
|
|
});
|
|
}
|