This repository has been archived by the owner on Jul 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.rs
63 lines (53 loc) · 1.43 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#![feature(unix_sigpipe)]
mod app;
mod commands;
mod helpers;
mod states;
mod systems;
use app::{Commands, CLI};
use clap::Parser;
use mimalloc::MiMalloc;
use starbase::tracing::TracingOptions;
use starbase::{App, MainResult};
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[unix_sigpipe = "sig_dfl"]
#[tokio::main]
async fn main() -> MainResult {
App::setup_diagnostics();
App::setup_tracing_with_options(TracingOptions {
filter_modules: vec![
"espm".into(),
"espresso".into(),
"schematic".into(),
"starbase".into(),
],
// log_env: "STARBASE_LOG".into(),
log_env: "ESPM_LOG".into(),
test_env: "ESPM_TEST".into(),
..TracingOptions::default()
});
let cli = CLI::parse();
let mut app = App::new();
app.set_state(cli.global_args());
app.set_state(cli.clone());
app.startup(systems::set_paths);
app.startup(systems::find_workspace);
app.startup(systems::load_store);
match cli.command {
Commands::Build(args) => {
app.execute_with_args(commands::build, args);
}
Commands::Debug => {
app.execute(commands::debug);
}
Commands::Init(args) => {
app.execute_with_args(commands::init, args);
}
Commands::New(args) => {
app.execute_with_args(commands::new, args);
}
};
app.run().await?;
Ok(())
}