git-next/src/main.rs
Paul Campbell e357da4346
Some checks failed
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline failed
ci/woodpecker/push/push-next Pipeline failed
chore(deps): update kxio to v1.1.0
2024-04-28 16:53:02 +01:00

46 lines
945 B
Rust

mod init;
mod server;
use std::path::PathBuf;
use clap::Parser;
use kxio::{fs, network::Network};
#[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,
}
#[actix_rt::main]
async fn main() {
let fs = fs::new(PathBuf::default());
let net = Network::new_real();
let commands = Commands::parse();
match commands.command {
Command::Init => {
init::run(fs);
}
Command::Server(server) => match server {
Server::Init => {
server::init(fs);
}
Server::Start => {
server::start(fs, net).await;
}
},
}
}