aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/completion.rs
blob: 4c2f4a84961cb87054cf44733855da69fbb4ccac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use clap::Args;
use clap::CommandFactory;
use clap_complete::aot::Shell;

#[derive(Args)]
pub struct CompletionArgs {
    /// The shell to generate completions for
    #[arg(value_enum)]
    pub shell: Shell,
}

pub fn execute(
    args: &CompletionArgs,
    _cli: &super::Cli,
    _console: &mozart_core::console::Console,
) -> anyhow::Result<()> {
    let mut cmd = super::Cli::command();
    clap_complete::aot::generate(args.shell, &mut cmd, "mozart", &mut std::io::stdout());
    Ok(())
}