Updated main bootstrap
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
fn void main() {
|
void main() {
|
||||||
mist_analyzer::start();
|
mist_analyzer::start();
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -4,8 +4,8 @@ use std::fs;
|
|||||||
use mist_api::builder;
|
use mist_api::builder;
|
||||||
use mist_api::transpiler;
|
use mist_api::transpiler;
|
||||||
|
|
||||||
fn void main() {
|
void main() {
|
||||||
let args Vec<String> = env::args().collect();
|
Vec<String> args = env::args().collect();
|
||||||
|
|
||||||
if args.len() < 2 {
|
if args.len() < 2 {
|
||||||
print_usage();
|
print_usage();
|
||||||
@@ -44,7 +44,7 @@ fn void main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn void print_usage() {
|
void print_usage() {
|
||||||
println!("Mist - the mist compiler\n");
|
println!("Mist - the mist compiler\n");
|
||||||
println!(" View our documentation! \x1b[35mhttps://mist.selimaj.dev\x1b[0m");
|
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!(" Follow us on github! \x1b[35mhttps://github.com/mist-go\x1b[0m\n");
|
||||||
@@ -66,7 +66,7 @@ fn void print_usage() {
|
|||||||
println!(" \x1b[36m mist help\x1b[0m print this message\n");
|
println!(" \x1b[36m mist help\x1b[0m print this message\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn void init_project(mut args Vec<String>) {
|
void init_project(Vec<String> mut args) {
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
|
|
||||||
process::Command::new("cargo")
|
process::Command::new("cargo")
|
||||||
@@ -77,7 +77,7 @@ fn void init_project(mut args Vec<String>) {
|
|||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to run cargo").wait().expect("Unable to wait");
|
.expect("Failed to run cargo").wait().expect("Unable to wait");
|
||||||
|
|
||||||
let is_lib bool = fs::metadata("src/lib.rs").is_ok();
|
bool is_lib = fs::metadata("src/lib.rs").is_ok();
|
||||||
|
|
||||||
if is_lib {
|
if is_lib {
|
||||||
fs::remove_file("src/lib.rs").expect("Failed to remove src/lib.rs");
|
fs::remove_file("src/lib.rs").expect("Failed to remove src/lib.rs");
|
||||||
@@ -92,10 +92,10 @@ fn void init_project(mut args Vec<String>) {
|
|||||||
println!("\n\x1b[34minfo\x1b[0m: Please open Cargo.toml and adjust `\x1b[35mname\x1b[0m = ` as needed, Thank you for using Mist!\n");
|
println!("\n\x1b[34minfo\x1b[0m: Please open Cargo.toml and adjust `\x1b[35mname\x1b[0m = ` as needed, Thank you for using Mist!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn void inject_mist_target(is_lib bool) {
|
void inject_mist_target(bool is_lib) {
|
||||||
let toml_content String = fs::read_to_string("Cargo.toml").expect("Failed to read Cargo.toml");
|
String toml_content = fs::read_to_string("Cargo.toml").expect("Failed to read Cargo.toml");
|
||||||
|
|
||||||
let inject *str = if is_lib {
|
str& inject = if is_lib {
|
||||||
"\n[lib]\nname = \"my_lib\"\npath = \".mist/src/lib.rs\"\n"
|
"\n[lib]\nname = \"my_lib\"\npath = \".mist/src/lib.rs\"\n"
|
||||||
} else {
|
} else {
|
||||||
"\n[[bin]]\nname = \"my_bin\"\npath = \".mist/src/main.rs\"\n"
|
"\n[[bin]]\nname = \"my_bin\"\npath = \".mist/src/main.rs\"\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user