init.rs

 1use anyhow::Result;
 2use std::path::Path;
 3
 4pub fn run(root: &Path, name: &str, json: bool) -> Result<()> {
 5    crate::db::init(root, name)?;
 6
 7    if json {
 8        println!(
 9            "{}",
10            serde_json::json!({"success": true, "project": name, "bound_path": root})
11        );
12    } else {
13        let c = crate::color::stderr_theme();
14        eprintln!("{}info:{} initialized project '{name}'", c.blue, c.reset);
15    }
16
17    Ok(())
18}