mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 10:38:31 +00:00
- Reworked `dcr.toml` handling: added read, validation, and edit through `core::config` - `new` and `init` use the new config creation logic - `build` and `run` now require `dcr.toml` and read `compiler` and `name` from it
37 lines
874 B
Rust
37 lines
874 B
Rust
use crate::utils::log::error;
|
|
mod cli;
|
|
mod config;
|
|
mod core;
|
|
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),
|
|
_ => {
|
|
error("Unknown command or argument");
|
|
0
|
|
}
|
|
};
|
|
|
|
std::process::exit(code);
|
|
}
|