Cargo commands

This commit is contained in:
2026-05-16 10:51:08 +02:00
parent 9d024b7e25
commit 90de040ae8
+7 -7
View File
@@ -1,4 +1,4 @@
use std::process; use std::process::{self, Command};
pub mod codegen; pub mod codegen;
pub mod compiler; pub mod compiler;
@@ -12,13 +12,11 @@ fn main() {
} }
match args[1].as_str() { match args[1].as_str() {
"build" => { "run" | "build" => {
if args.len() < 2 {
eprintln!("error: expected a file path\n usage: mist build");
process::exit(1);
}
compiler::build(); compiler::build();
Command::new("cargo").args(&args[1..]).status().unwrap();
} }
"transpile" => compiler::build(),
"version" | "--version" | "-v" => { "version" | "--version" | "-v" => {
println!("mist {}", env!("CARGO_PKG_VERSION")); println!("mist {}", env!("CARGO_PKG_VERSION"));
} }
@@ -37,7 +35,9 @@ fn print_usage() {
println!("mist - the mist compiler"); println!("mist - the mist compiler");
println!(); println!();
println!("usage:"); 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 <file.ms> parse and validate without compiling"); println!(" mist check <file.ms> parse and validate without compiling");
println!(" mist version print the compiler version"); println!(" mist version print the compiler version");
println!(" mist help print this message"); println!(" mist help print this message");