use std::io;
use clap::{value_parser, CommandFactory, Parser};
use clap_complete::Shell;
use color_eyre::Result;
use tracing::info;
use crate::cli::Cli;
#[derive(Debug, Parser)]
pub struct CompletionGenerateCommand {
#[arg(value_parser = value_parser!(Shell))]
pub shell: Shell,
}
impl CompletionGenerateCommand {
pub async fn execute(self) -> Result<()> {
info!("executing generate completion command");
let mut cmd = Cli::command();
let name = cmd.get_name().to_string();
clap_complete::generate(self.shell, &mut cmd, name, &mut io::stdout());
Ok(())
}
}