cargo-spiel/src/main.rs
2025-05-14 17:35:58 +02:00

35 lines
745 B
Rust

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));
}