From 949c6459aa7683453a7160423b689ceadb08954b Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Sep 2024 08:04:48 +0100 Subject: refactor: organise into lib and bin structure the make the code more readable this commit just moves the files, the next commit should fix the imports --- src/bin/ngit/main.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/bin/ngit/main.rs (limited to 'src/bin/ngit/main.rs') diff --git a/src/bin/ngit/main.rs b/src/bin/ngit/main.rs new file mode 100644 index 0000000..97e5981 --- /dev/null +++ b/src/bin/ngit/main.rs @@ -0,0 +1,26 @@ +#![cfg_attr(not(test), warn(clippy::pedantic))] +#![allow(clippy::large_futures)] +#![cfg_attr(not(test), warn(clippy::expect_used))] + +use anyhow::Result; +use clap::Parser; +use cli::{Cli, Commands}; + +mod cli; +use ngit::*; + +mod sub_commands; + +#[tokio::main] +async fn main() -> Result<()> { + let cli = Cli::parse(); + match &cli.command { + Commands::Fetch(args) => sub_commands::fetch::launch(&cli, args).await, + Commands::Login(args) => sub_commands::login::launch(&cli, args).await, + Commands::Init(args) => sub_commands::init::launch(&cli, args).await, + Commands::Send(args) => sub_commands::send::launch(&cli, args, false).await, + Commands::List => sub_commands::list::launch().await, + Commands::Pull => sub_commands::pull::launch().await, + Commands::Push(args) => sub_commands::push::launch(&cli, args).await, + } +} -- cgit v1.2.3