Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ pub enum SubCommands {
/// List of project IDs or case-insensitive names of mods to remove
mod_names: Vec<String>,
},
/// 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)]
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
}
};

Expand Down
28 changes: 16 additions & 12 deletions src/subcommands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub async fn get_platform_downloadables(
curseforge: Furse,
github: Octocrab,
profile: &Profile,
short: bool,
) -> Result<(Vec<PlatformDownloadable>, bool)> {
let to_download = Arc::new(Mutex::new(Vec::new()));
let progress_bar = Arc::new(Mutex::new(
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down