Skip to main content

print_shell_completion

Function print_shell_completion 

Source
pub fn print_shell_completion<C>(shell: Shell)
where C: CommandFactory,
Expand description

Writes shell completion output to stdout.

§Type Parameters

  • C: The consumer CLI parser type used to build the clap command.

§Arguments

  • shell: Shell whose completion script should be generated.

§Returns

This function writes to stdout and returns no value.

§Examples

use clap::Parser;
use clap_complete::aot::Shell;
use rust_config_tree::print_shell_completion;

#[derive(Parser)]
#[command(name = "myapp")]
struct Cli {}

print_shell_completion::<Cli>(Shell::Bash);