mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 22:19:36 +00:00
Rewrite project from Python to Rust and add Windows/MacOS supports
This commit is contained in:
34
src/main.rs
Normal file
34
src/main.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
mod cli;
|
||||
mod config;
|
||||
mod utils;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
|
||||
if args.len() < 2 {
|
||||
std::process::exit(cli::help::help());
|
||||
}
|
||||
|
||||
let cmd = args[1].as_str();
|
||||
let rest = &args[2..];
|
||||
|
||||
let code = match cmd {
|
||||
"new" => cli::r#new::new(rest),
|
||||
"init" => cli::init::init(rest),
|
||||
"build" => cli::build::build(rest),
|
||||
"run" => cli::run::run(rest),
|
||||
"clean" => cli::clean::clean(rest),
|
||||
"--version" => {
|
||||
println!("dcr {} ({})", env!("CARGO_PKG_VERSION"), env!("DCR_TARGET"));
|
||||
0
|
||||
}
|
||||
"--help" => cli::help::help(),
|
||||
"--update" => cli::flag_update::flag_update(rest),
|
||||
_ => {
|
||||
println!("Неизвестная команда или аргумент");
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
std::process::exit(code);
|
||||
}
|
||||
Reference in New Issue
Block a user