diff options
Diffstat (limited to 'src/subcommands/generate_completion.rs')
-rw-r--r-- | src/subcommands/generate_completion.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/subcommands/generate_completion.rs b/src/subcommands/generate_completion.rs new file mode 100644 index 00000000..00425b7f --- /dev/null +++ b/src/subcommands/generate_completion.rs @@ -0,0 +1,11 @@ +use clap::CommandFactory; +use clap_complete::{generate, Shell}; + +use crate::cli; + +pub fn generate_completion_file(shell: Shell) -> std::io::Result<()> { + let mut cmd = cli::Opt::command(); + let bin_name = cmd.get_bin_name().unwrap_or(cmd.get_name()).to_string(); + generate(shell, &mut cmd, bin_name, &mut std::io::stdout()); + Ok(()) +} |