forked from kemitix/git-next
47 lines
1,005 B
Rust
47 lines
1,005 B
Rust
mod init;
|
|
mod server;
|
|
|
|
use clap::Parser;
|
|
use kxio::{filesystem, network::Network};
|
|
|
|
use crate::server::git::Git;
|
|
|
|
#[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 = filesystem::FileSystem::new_real(None);
|
|
let net = Network::new_real();
|
|
let git = Git::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, git).await;
|
|
}
|
|
},
|
|
}
|
|
}
|