feat: matcha new scaffolds from embedded starter

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-07-11 12:59:38 -05:00
1 parent dba24aa50a
commit 7044e50982
3 files changed
+50 -1

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
use std::io::{Error, ErrorKind};
use std::path::Path;
use crate::template;
pub fn run(name: &str, template_url: Option<&str>) -> std::io::Result<()> {
let dest = Path::new(name);
if dest.exists() {
return Err(Error::new(ErrorKind::AlreadyExists,
format!("'{name}' already exists")));
}
std::fs::create_dir_all(dest)?;
match template_url {
None => template::write_starter(dest, name)?,
Some(_) => return Err(Error::new(ErrorKind::Unsupported,
"--template-url not implemented yet")),
}
println!("✓ created {name}\n cd {name} && matcha run");
Ok(())
}