ravel-cli 0.1.0

CLI tool for the Ravel framework: project scaffolding, code generation, migrations, dev server
//! ravel serve — start the development server.
//!
//! Runs `cargo run` which builds and starts the project binary.

use anyhow::Result;
use std::process::Command;

pub fn handle() -> Result<()> {
    println!("🚀 Starting server...");

    let status = Command::new("cargo").arg("run").status()?;

    if !status.success() {
        // ctrl-c gives non-zero; that's fine
        if let Some(code) = status.code()
            && code != 130
        {
            anyhow::bail!("Server exited with code {code}");
        }
    }

    Ok(())
}