run-what 0.94.0

HTML-first web framework powered by Rust. No JavaScript frameworks, no build steps—just HTML.
//! Interactive wizard for project creation

use anyhow::Result;
use dialoguer::{Confirm, Select, theme::ColorfulTheme};

/// Template choice returned by the wizard
pub enum TemplateChoice {
    Minimum,
    Tutorial,
}

/// Ask user which template they want
pub fn choose_template() -> Result<TemplateChoice> {
    let choices = &[
        "Minimum  - Skeleton with a layout and landing page",
        "Tutorial - Guided tutorial with 10 interactive lessons",
    ];

    println!();
    let selection = Select::with_theme(&ColorfulTheme::default())
        .with_prompt("Choose a template")
        .items(choices)
        .default(0)
        .interact()?;

    Ok(match selection {
        0 => TemplateChoice::Minimum,
        _ => TemplateChoice::Tutorial,
    })
}

/// Check if directory exists and prompt for overwrite
pub fn confirm_overwrite(name: &str) -> Result<bool> {
    Confirm::with_theme(&ColorfulTheme::default())
        .with_prompt(format!("Directory '{}' already exists. Overwrite?", name))
        .default(false)
        .interact()
        .map_err(Into::into)
}