generate_completions

Function generate_completions 

Source
pub fn generate_completions<T: CommandFactory>(shell: Shell)
Expand description

Generate shell completion scripts for a clap-based CLI.

This function generates shell completions and prints both installation instructions and the completion script to stdout. It supports bash, zsh, fish, elvish, and PowerShell.

§Type Parameters

  • T - A type that implements CommandFactory (typically your clap Cli struct)

§Arguments

  • shell - The shell type to generate completions for

§Examples

use clap::Parser;
use workhelix_cli_common::completions::generate_completions;

#[derive(Parser)]
struct Cli {
    // your CLI definition
}

generate_completions::<Cli>(clap_complete::Shell::Bash);