feat(update): add strucutre for update command
This commit is contained in:
parent
86a46f7562
commit
f6d47e4b4d
3 changed files with 58 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
pub mod create;
|
||||
pub mod install;
|
||||
pub mod search;
|
||||
pub mod update;
|
||||
|
|
|
|||
28
src/commands/update.rs
Normal file
28
src/commands/update.rs
Normal 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(())
|
||||
}
|
||||
}
|
||||
30
src/main.rs
30
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<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(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue