mirror of
https://codeberg.org/insects/cargo-spiel
synced 2025-05-23 18:43:42 +00:00
initial commit
This commit is contained in:
commit
1cea94ea19
22 changed files with 2780 additions and 0 deletions
35
src/main.rs
Normal file
35
src/main.rs
Normal file
|
@ -0,0 +1,35 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
use tokio::runtime::Builder;
|
||||
|
||||
mod server;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version)]
|
||||
struct CliArgs {
|
||||
/// Directory of the Cargo project
|
||||
#[arg(short, long)]
|
||||
pub project: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = CliArgs::parse();
|
||||
let runtime = Builder::new_current_thread()
|
||||
.worker_threads(2)
|
||||
.enable_io()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let project_path = if let Some(custom_path) = args.project {
|
||||
custom_path
|
||||
} else {
|
||||
std::env::current_dir().unwrap()
|
||||
};
|
||||
println!(
|
||||
"{:>12} Starting server in {}...",
|
||||
"spiel",
|
||||
project_path.to_str().unwrap()
|
||||
);
|
||||
runtime.block_on(server::start(project_path));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue