d3dfedc95b
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 12m43s
Rust / build (map[name:stable]) (push) Successful in 18m7s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 7m43s
77 lines
1.7 KiB
Rust
77 lines
1.7 KiB
Rust
//
|
|
#![allow(clippy::module_name_repetitions)]
|
|
|
|
mod alerts;
|
|
mod file_watcher;
|
|
mod forge;
|
|
mod init;
|
|
mod repo;
|
|
mod server;
|
|
|
|
#[cfg(feature = "tui")]
|
|
mod tui;
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|
|
mod webhook;
|
|
|
|
use git_next_core::git;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use clap::Parser;
|
|
use color_eyre::Result;
|
|
use kxio::{fs, net};
|
|
|
|
#[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 {
|
|
/// Display a UI (experimental)
|
|
#[cfg(feature = "tui")]
|
|
#[arg(long, required = false)]
|
|
ui: bool,
|
|
},
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
let fs = fs::new(PathBuf::default());
|
|
let net = net::new();
|
|
let repository_factory = git::repository::factory::real();
|
|
let commands = Commands::parse();
|
|
|
|
match commands.command {
|
|
Command::Init => init::run(&fs),
|
|
Command::Server(server) => match server {
|
|
Server::Init => server::init(&fs),
|
|
#[cfg(not(feature = "tui"))]
|
|
Server::Start {} => server::start(
|
|
false,
|
|
fs,
|
|
net,
|
|
repository_factory,
|
|
std::time::Duration::from_secs(10),
|
|
),
|
|
#[cfg(feature = "tui")]
|
|
Server::Start { ui } => server::start(
|
|
ui,
|
|
fs,
|
|
net,
|
|
repository_factory,
|
|
std::time::Duration::from_secs(10),
|
|
),
|
|
},
|
|
}
|
|
}
|