Skip to main content

bb_cli/commands/
completions.rs

1use clap::CommandFactory;
2use clap_complete::Shell;
3
4/// Writes a completion script for `shell` to stdout. The command factory is
5/// supplied by the caller so this module does not depend on the binary's types.
6pub fn generate<C: CommandFactory>(shell: Shell) {
7    let mut command = C::command();
8    let name = command.get_name().to_string();
9    clap_complete::generate(shell, &mut command, name, &mut std::io::stdout());
10}