Merge pull request #30 from mist-go/improved-cli-readme

Improved cli and readme
This commit is contained in:
2026-05-16 11:13:44 +02:00
committed by GitHub
2 changed files with 19 additions and 19 deletions
+3 -7
View File
@@ -4,13 +4,9 @@
Originally this readme was part of the Carbon Language project, licensed with Apache-2.0 Originally this readme was part of the Carbon Language project, licensed with Apache-2.0
--> -->
<!-- <p align="center"> <p align="center">
<a href="#why-build-carbon">Why?</a> | <a href="https://mist.selimaj.dev">Documentation</a>
<a href="#language-goals">Goals</a> | </p>
<a href="#project-status">Status</a> |
<a href="#getting-started">Getting started</a> |
<a href="#join-us">Join us</a>
</p> -->
<img src="code.png" align="right" width="575" alt=""> <img src="code.png" align="right" width="575" alt="">
+16 -12
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" | "r" | "b" => {
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" | "t" => compiler::build(),
"version" | "--version" | "-v" => { "version" | "--version" | "-v" => {
println!("mist {}", env!("CARGO_PKG_VERSION")); println!("mist {}", env!("CARGO_PKG_VERSION"));
} }
@@ -34,11 +32,17 @@ fn main() {
} }
fn print_usage() { fn print_usage() {
println!("mist - the mist compiler"); println!("Mist - the mist compiler\n");
println!(); println!("󰖟 View our documentation! \x1b[35mhttps://mist.selimaj.dev\x1b[0m");
println!(" Follow us on github! \x1b[35mhttps://github.com/mist-go\x1b[0m\n");
println!("usage:"); println!("usage:");
println!(" mist build compile the project in the current directory"); println!(" \x1b[36m mist run\x1b[0m run the project in the current directory\n");
println!(" mist check <file.ms> parse and validate without compiling"); println!(
println!(" mist version print the compiler version"); " \x1b[36m mist build\x1b[0m build the project in the current directory\n"
println!(" mist help print this message"); );
println!(
" \x1b[36m mist transpile\x1b[0m transpile the project in the current directory\n"
);
println!(" \x1b[36m mist version \x1b[0m print the compiler version\n");
println!(" \x1b[36m mist help\x1b[0m print this message\n");
} }