summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src/completions.rs
blob: 51e7db1033194c9e2e83fbf08fa129c1488d7708 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::io::stdout;

use clap::CommandFactory;
use clap_complete::generate;

use crate::args::{CliArguments, CompletionsCommand};

/// Execute the completions command.
pub fn completions(command: &CompletionsCommand) {
    let mut cmd = CliArguments::command();
    let bin_name = cmd.get_name().to_string();
    generate(command.shell, &mut cmd, bin_name, &mut stdout());
}