From f6d47e4b4d72bf2076290668058bc71698eee613 Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 3 Sep 2026 16:58:54 +0500 Subject: [PATCH] feat(update): add strucutre for update command --- src/commands/mod.rs | 1 + src/commands/update.rs | 28 ++++++++++++++++++++++++++++ src/main.rs | 30 +++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/commands/update.rs diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 83e620d..51a02d0 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,3 +1,4 @@ pub mod create; pub mod install; pub mod search; +pub mod update; diff --git a/src/commands/update.rs b/src/commands/update.rs new file mode 100644 index 0000000..46576b3 --- /dev/null +++ b/src/commands/update.rs @@ -0,0 +1,28 @@ +use std::error::Error; + +pub struct Update { + mods_only: bool, + loader_only: bool, + loader_version: Option, + version: Option, +} + +impl Update { + pub fn new( + mods_only: bool, + loader_only: bool, + loader_version: Option, + version: Option, + ) -> Self { + Self { + mods_only, + loader_only, + loader_version, + version, + } + } + + pub async fn run(&self) -> Result<(), Box> { + Ok(()) + } +} diff --git a/src/main.rs b/src/main.rs index 6d33756..189cebc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ mod commands; mod models; mod utils; -use crate::commands::{create::Create, install::Install, search::Search}; +use crate::commands::{create::Create, install::Install, search::Search, update::Update}; use clap::{ Parser, Subcommand, builder::styling::{self}, @@ -75,6 +75,20 @@ enum Commands { #[arg(trailing_var_arg = true)] mods: Vec, }, + + Update { + #[arg(long, conflicts_with_all = ["loader_only", "loader_version"])] + mods_only: bool, + + #[arg(long, conflicts_with_all = ["mods_only", "version"])] + loader_only: bool, + + #[arg(long, conflicts_with = "mods_only")] + loader_version: Option, + + #[arg(long, conflicts_with = "loader_only")] + version: Option, + }, } #[tokio::main] @@ -120,6 +134,20 @@ async fn main() -> Result<(), Box> { let install = Install::new(mods); install.run().await?; } + Commands::Update { + mods_only, + loader_only, + loader_version, + version, + } => { + let update = Update::new( + mods_only, + loader_only, + loader_version, + version, + ); + update.run().await?; + } } Ok(())