spec_driven_docs/commands/completions.rs
1//! `completions` subcommand: runtime-shape.
2//!
3//! Generates shell completions for the full command surface to stdout.
4
5use clap::CommandFactory;
6
7use crate::cli::completions::CompletionsArgs;
8use crate::context::AppContext;
9use crate::error::AppError;
10use crate::output;
11
12/// Generate completions for one shell.
13///
14/// # Errors
15///
16/// None.
17pub fn run(_ctx: &AppContext, args: CompletionsArgs) -> Result<(), AppError> {
18 let mut buffer = Vec::new();
19 clap_complete::generate(
20 args.shell,
21 &mut crate::cli::Cli::command(),
22 "sdd",
23 &mut buffer,
24 );
25 output::raw(&buffer);
26 Ok(())
27}