diff --git a/src/cli.rs b/src/cli.rs index 29f28ac..86351b6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -90,8 +90,12 @@ pub enum SubCommands { /// List of project IDs or case-insensitive names of mods to remove mod_names: Vec, }, - /// Download and install the latest compatible version of your mods - Upgrade, + /// Download and install the latest version of the mods specified + Upgrade { + #[clap(long, short)] + /// Don’t print compatible mods + short: bool, + }, } #[derive(Subcommand)] diff --git a/src/main.rs b/src/main.rs index 5543d64..f5af2d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -387,11 +387,11 @@ async fn actual_main(cli_app: Ferium) -> Result<()> { check_empty_profile(profile)?; subcommands::remove(profile, mod_names)?; } - SubCommands::Upgrade => { + SubCommands::Upgrade { short } => { check_internet().await?; let profile = get_active_profile(&mut config)?; check_empty_profile(profile)?; - subcommands::upgrade(modrinth, curseforge, github, profile).await?; + subcommands::upgrade(modrinth, curseforge, github, profile, short).await?; } }; diff --git a/src/subcommands/upgrade.rs b/src/subcommands/upgrade.rs index 4a134df..0197549 100644 --- a/src/subcommands/upgrade.rs +++ b/src/subcommands/upgrade.rs @@ -61,6 +61,7 @@ pub async fn get_platform_downloadables( curseforge: Furse, github: Octocrab, profile: &Profile, + short: bool, ) -> Result<(Vec, bool)> { let to_download = Arc::new(Mutex::new(Vec::new())); let progress_bar = Arc::new(Mutex::new( @@ -72,7 +73,7 @@ pub async fn get_platform_downloadables( let modrinth = Arc::new(modrinth); let github = Arc::new(github); - println!("{}\n", "Determining the Latest Compatible Versions".bold()); + println!("{}", "Determining the Latest Compatible Versions".bold()); let semaphore = Arc::new(Semaphore::new(75)); progress_bar .lock() @@ -144,16 +145,18 @@ pub async fn get_platform_downloadables( progress_bar.inc(1); match result { Ok((downloadable, backwards_compat)) => { - progress_bar.println(format!( - "{} {:43} {}", - if backwards_compat { - YELLOW_TICK.clone() - } else { - TICK.clone() - }, - mod_.name, - downloadable.filename().dimmed() - )); + if !short { + progress_bar.println(format!( + "{} {:43} {}", + if backwards_compat { + YELLOW_TICK.clone() + } else { + TICK.clone() + }, + mod_.name, + downloadable.filename().dimmed() + )); + } { to_download .lock() @@ -211,9 +214,10 @@ pub async fn upgrade( curseforge: Furse, github: Octocrab, profile: &Profile, + short: bool, ) -> Result<()> { let (to_download, error) = - get_platform_downloadables(modrinth, curseforge, github, profile).await?; + get_platform_downloadables(modrinth, curseforge, github, profile, short).await?; let mut to_download = to_download .into_iter() .map(TryInto::try_into)