2024-04-06 18:39:20 +01:00
|
|
|
mod init;
|
2024-04-06 18:42:34 +01:00
|
|
|
mod server;
|
2024-04-06 18:39:20 +01:00
|
|
|
|
2024-04-06 18:26:08 +01:00
|
|
|
use clap::Parser;
|
2024-04-09 10:44:01 +01:00
|
|
|
use kxio::{filesystem, network::Network};
|
2024-04-06 18:26:08 +01:00
|
|
|
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
#[clap(version = clap::crate_version!(), author = clap::crate_authors!(), about = clap::crate_description!())]
|
|
|
|
struct Commands {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
command: Command,
|
|
|
|
}
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
enum Command {
|
|
|
|
Init,
|
|
|
|
#[clap(subcommand)]
|
|
|
|
Server(Server),
|
|
|
|
}
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
enum Server {
|
|
|
|
Init,
|
|
|
|
Start,
|
|
|
|
}
|
2024-04-12 12:58:07 +01:00
|
|
|
|
|
|
|
#[actix_rt::main]
|
|
|
|
async fn main() {
|
2024-04-07 11:52:47 +01:00
|
|
|
let fs = filesystem::FileSystem::new_real(None);
|
2024-04-09 10:44:01 +01:00
|
|
|
let net = Network::new_real();
|
2024-04-06 18:26:08 +01:00
|
|
|
let commands = Commands::parse();
|
|
|
|
|
|
|
|
match commands.command {
|
|
|
|
Command::Init => {
|
2024-04-07 11:52:47 +01:00
|
|
|
init::run(fs);
|
2024-04-06 18:26:08 +01:00
|
|
|
}
|
|
|
|
Command::Server(server) => match server {
|
|
|
|
Server::Init => {
|
2024-04-07 11:52:47 +01:00
|
|
|
server::init(fs);
|
2024-04-06 18:26:08 +01:00
|
|
|
}
|
|
|
|
Server::Start => {
|
2024-04-12 12:58:07 +01:00
|
|
|
server::start(fs, net).await;
|
2024-04-06 18:26:08 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2024-04-06 17:39:56 +01:00
|
|
|
}
|