feat(update): add strucutre for update command

This commit is contained in:
RafayAhmad7548 2026-09-03 16:58:54 +05:00
parent 86a46f7562
commit f6d47e4b4d
Signed by: RafayAhmad
SSH key fingerprint: SHA256:WURX8viobA1uawb4dWM3LqYrY+XPcZcXhAXAlrYdhtE
3 changed files with 58 additions and 1 deletions

View file

@ -1,3 +1,4 @@
pub mod create;
pub mod install;
pub mod search;
pub mod update;

28
src/commands/update.rs Normal file
View file

@ -0,0 +1,28 @@
use std::error::Error;
pub struct Update {
mods_only: bool,
loader_only: bool,
loader_version: Option<String>,
version: Option<String>,
}
impl Update {
pub fn new(
mods_only: bool,
loader_only: bool,
loader_version: Option<String>,
version: Option<String>,
) -> Self {
Self {
mods_only,
loader_only,
loader_version,
version,
}
}
pub async fn run(&self) -> Result<(), Box<dyn Error>> {
Ok(())
}
}

View file

@ -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<String>,
},
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<String>,
#[arg(long, conflicts_with = "loader_only")]
version: Option<String>,
},
}
#[tokio::main]
@ -120,6 +134,20 @@ async fn main() -> Result<(), Box<dyn Error>> {
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(())