forked from kemitix/git-next
Paul Campbell
58e991b2b7
Adds a layer around Repository to allow the use of a mock. Mock has still to be implemented.
49 lines
1 KiB
Rust
49 lines
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::new();
|
|
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 => {
|
|
git_next_server::start(fs, net, repo).await;
|
|
}
|
|
},
|
|
}
|
|
}
|