lmrc-cli 0.3.16

CLI tool for scaffolding LMRC Stack infrastructure projects
Documentation
use colored::Colorize;
use lmrc_config_validator::LmrcConfig;
use std::path::PathBuf;

use crate::error::Result;

pub async fn execute(output: String) -> Result<()> {
    println!("{}", "Generating template configuration...".green());

    let config = LmrcConfig::template();
    let toml_content = config.to_toml_string()?;

    let output_path = PathBuf::from(output);
    std::fs::write(&output_path, toml_content)?;

    println!(
        "{} {}",
        "Template configuration written to:".green(),
        output_path.display().to_string().cyan()
    );
    println!(
        "\nEdit this file and use it with: lmrc new --config {}",
        output_path.display()
    );

    Ok(())
}