Skip to main content

spec_driven_docs/commands/
license.rs

1//! `license` subcommand: runtime-shape.
2//!
3//! Prints the license statement, or a specific half's full text, so the
4//! terms travel with the binary. The texts live in `embedded`.
5
6use crate::cli::license::LicenseArgs;
7use crate::context::AppContext;
8use crate::error::AppError;
9use crate::output;
10
11/// Print license terms.
12///
13/// # Errors
14///
15/// None.
16pub fn run(_ctx: &AppContext, args: LicenseArgs) -> Result<(), AppError> {
17    if !args.method && !args.payload && !args.third_party {
18        output::line(crate::embedded::LICENSE.trim_end_matches('\n'));
19        return Ok(());
20    }
21    if args.method {
22        output::line(crate::embedded::LICENSE_CC_BY.trim_end_matches('\n'));
23    }
24    if args.payload {
25        output::line(crate::embedded::LICENSE_MIT.trim_end_matches('\n'));
26    }
27    if args.third_party {
28        output::line(crate::embedded::THIRD_PARTY_NOTICES.trim_end_matches('\n'));
29    }
30    Ok(())
31}