diff options
Diffstat (limited to 'tool/src/bin/generate_completions.rs')
-rw-r--r-- | tool/src/bin/generate_completions.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tool/src/bin/generate_completions.rs b/tool/src/bin/generate_completions.rs new file mode 100644 index 0000000..9f0917f --- /dev/null +++ b/tool/src/bin/generate_completions.rs @@ -0,0 +1,18 @@ +use clap::{CommandFactory, Parser, ValueEnum}; +use clap_complete::{generate_to, Shell}; +use jellytool::cli; +use std::{fs::create_dir_all, path::PathBuf}; + +#[derive(Parser)] +struct Args { + out_dir: PathBuf, +} + +fn main() -> anyhow::Result<()> { + let args = Args::parse(); + create_dir_all(&args.out_dir)?; + for &shell in Shell::value_variants() { + generate_to(shell, &mut cli::Args::command(), "jellytool", &args.out_dir)?; + } + Ok(()) +} |