spec_driven_docs/commands/init.rs
1//! `init` subcommand: runtime-shape.
2//!
3//! Projects the flags into the installer's options and prints its report.
4//! Install semantics live in `services::installer`.
5
6use crate::cli::init::InitArgs;
7use crate::context::AppContext;
8use crate::error::AppError;
9use crate::output;
10use crate::services::installer::{InitOptions, init};
11
12/// Install the payload into a target repository.
13///
14/// # Errors
15///
16/// Whatever the installer refuses; see [`init`].
17pub fn run(_ctx: &AppContext, args: InitArgs) -> Result<(), AppError> {
18 let outcome = init(&InitOptions {
19 target: args.target,
20 profile: args.profile,
21 apply: args.apply,
22 dry_run: args.dry_run,
23 })?;
24 for line in &outcome.lines {
25 output::line(line);
26 }
27 Ok(())
28}