hyperhive/hivectl/src/completions.rs

14 lines
632 B
Rust

//! `hivectl completions <shell>` — emit a shell completion script,
//! generated from the live clap command tree so it never drifts from the
//! actual verbs and flags.
use crate::cli::Cli;
/// Emit a shell completion script for `hivectl` to stdout. Walks the clap
/// command tree (the single source of truth — same tree `markdown-docs`
/// renders) so completions never drift from the actual verbs/flags.
pub(crate) fn generate_completions(shell: clap_complete::Shell) {
use clap::CommandFactory as _;
let mut cmd = Cli::command();
clap_complete::generate(shell, &mut cmd, "hivectl", &mut std::io::stdout());
}