diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-04 08:04:48 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-04 13:30:59 +0100 |
| commit | 949c6459aa7683453a7160423b689ceadb08954b (patch) | |
| tree | 230c26ecb11b99916e5570e548673eb09ecf0a36 /src/bin/ngit/main.rs | |
| parent | a825311f2c55661aaab3a163bda9109295c96044 (diff) | |
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
Diffstat (limited to 'src/bin/ngit/main.rs')
| -rw-r--r-- | src/bin/ngit/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ | |||
| 1 | #![cfg_attr(not(test), warn(clippy::pedantic))] | ||
| 2 | #![allow(clippy::large_futures)] | ||
| 3 | #![cfg_attr(not(test), warn(clippy::expect_used))] | ||
| 4 | |||
| 5 | use anyhow::Result; | ||
| 6 | use clap::Parser; | ||
| 7 | use cli::{Cli, Commands}; | ||
| 8 | |||
| 9 | mod cli; | ||
| 10 | use ngit::*; | ||
| 11 | |||
| 12 | mod sub_commands; | ||
| 13 | |||
| 14 | #[tokio::main] | ||
| 15 | async fn main() -> Result<()> { | ||
| 16 | let cli = Cli::parse(); | ||
| 17 | match &cli.command { | ||
| 18 | Commands::Fetch(args) => sub_commands::fetch::launch(&cli, args).await, | ||
| 19 | Commands::Login(args) => sub_commands::login::launch(&cli, args).await, | ||
| 20 | Commands::Init(args) => sub_commands::init::launch(&cli, args).await, | ||
| 21 | Commands::Send(args) => sub_commands::send::launch(&cli, args, false).await, | ||
| 22 | Commands::List => sub_commands::list::launch().await, | ||
| 23 | Commands::Pull => sub_commands::pull::launch().await, | ||
| 24 | Commands::Push(args) => sub_commands::push::launch(&cli, args).await, | ||
| 25 | } | ||
| 26 | } | ||