kutil_cli/clap/
completion.rs

1use {clap::*, clap_complete_command::*, std::io};
2
3//
4// Completion
5//
6
7/// Clap command to generate shell auto-completion scripts.
8#[derive(Args, Clone, Debug)]
9pub struct Completion {
10    /// shell
11    #[arg(value_enum)]
12    shell: Shell,
13}
14
15impl Completion {
16    /// Run command.
17    pub fn run<ParserT>(&self)
18    where
19        ParserT: Parser,
20    {
21        self.shell.generate(&mut ParserT::command(), &mut io::stdout());
22    }
23}