use crate::cli::Cli;
use usage::miette::Result;
pub(crate) fn generate() -> Result<()> {
// The declaration *is* the spec: the same tables that parsed the command line print it,
// with no bridge and no second model in between. `effect` in particular is now declared
// on each command rather than patched in here afterwards, since clap could not say it,
// and `repository` and `source_code_link_template` used to be appended here from a
// checked-in KDL fragment for the same reason — the derive can say both now.
println!("// @generated by usage-cli from its own parse tables");
println!("{}", Cli::to_kdl().trim());
Ok(())
}
pub(crate) fn complete(shell: &str) -> Result<()> {
let shell = usage_rs::complete::Shell::from_name(shell)
.ok_or_else(|| usage::miette::miette!("unsupported shell: {shell}"))?;
print!("{}", Cli::completion_script(shell));
Ok(())
}