Skip to main content

packc/cli/
config.rs

1#![forbid(unsafe_code)]
2
3use anyhow::Result;
4use clap::Parser;
5use greentic_config::explain;
6
7#[derive(Debug, Clone, Parser)]
8pub struct ConfigArgs {}
9
10pub fn handle(
11    _args: ConfigArgs,
12    json: bool,
13    runtime: &crate::runtime::RuntimeContext,
14) -> Result<()> {
15    let report = explain(
16        &runtime.resolved.config,
17        &runtime.resolved.provenance,
18        &runtime.resolved.warnings,
19    );
20    if json {
21        println!("{}", serde_json::to_string_pretty(&report.json)?);
22    } else {
23        println!("{}", report.text);
24    }
25    Ok(())
26}