Paul Campbell
ffab1986a7
Some checks failed
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
Rust / build (push) Has been cancelled
ci/woodpecker/push/tag-created Pipeline was successful
50 lines
1.1 KiB
Rust
50 lines
1.1 KiB
Rust
mod init;
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|
|
|
|
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 repo = git_next_git::repository::real();
|
|
let commands = Commands::parse();
|
|
|
|
match commands.command {
|
|
Command::Init => {
|
|
init::run(fs);
|
|
}
|
|
Command::Server(server) => match server {
|
|
Server::Init => {
|
|
git_next_server::init(fs);
|
|
}
|
|
Server::Start => {
|
|
let sleep_duration = std::time::Duration::from_secs(10);
|
|
git_next_server::start(fs, net, repo, sleep_duration).await;
|
|
}
|
|
},
|
|
}
|
|
}
|