use std::io;
use clap::{CommandFactory, Parser};
use clap_complete::Shell;
use repograph_core::RepographError;
#[derive(Debug, Parser)]
pub struct Args {
#[arg(value_name = "SHELL")]
pub shell: Shell,
}
#[tracing::instrument(skip(args), fields(shell = ?args.shell))]
pub fn run(args: &Args) -> Result<(), RepographError> {
tracing::debug!(command = "completions", shell = ?args.shell, "start");
let mut cmd = crate::Cli::command();
let mut stdout = io::stdout().lock();
clap_complete::generate(args.shell, &mut cmd, "repograph", &mut stdout);
tracing::info!(shell = ?args.shell, "completions generated");
Ok(())
}