diff --git a/src/main.rs b/src/main.rs index e874403..be0304b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::process; +use std::process::{self, Command}; pub mod codegen; pub mod compiler; @@ -12,13 +12,11 @@ fn main() { } match args[1].as_str() { - "build" => { - if args.len() < 2 { - eprintln!("error: expected a file path\n usage: mist build"); - process::exit(1); - } + "run" | "build" => { compiler::build(); + Command::new("cargo").args(&args[1..]).status().unwrap(); } + "transpile" => compiler::build(), "version" | "--version" | "-v" => { println!("mist {}", env!("CARGO_PKG_VERSION")); } @@ -37,7 +35,9 @@ fn print_usage() { println!("mist - the mist compiler"); println!(); println!("usage:"); - println!(" mist build compile the project in the current directory"); + println!(" mist run run the project in the current directory"); + println!(" mist build build the project in the current directory"); + println!(" mist transpile transpile the project in the current directory"); println!(" mist check parse and validate without compiling"); println!(" mist version print the compiler version"); println!(" mist help print this message");