Skip to content

Commit

Permalink
Added mod overrides for mod loader and game version
Browse files Browse the repository at this point in the history
  • Loading branch information
theRookieCoder committed Apr 21, 2022
1 parent d0e05fd commit 0475f7c
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 253 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog for Ferium

## [3.21.0] - 20.04.2022

- Removed `no_patch_check` flag for the upgrade command
- There are now overrides for game version and mod loader checks. For now there is no UI, you have to edit the config file manually

## [3.20.1] - 16.04.2022

When picking a file from a version, Ferium will get the primary file rather than the first file

## [3.20.0] - 16.04.2022

- Added a `Downloadable` struct that represents (and be converted from) a mod file from Modrinth, GitHub Releases, or CurseForge
Expand Down
60 changes: 29 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ferium"
version = "3.20.0"
version = "3.21.0"
edition = "2021"
authors = ["Ilesh Thiada (theRookieCoder) <[email protected]>", "Daniel Hauck (SolidTux)"]
description = "Ferium is a CLI program for managing Minecraft mods from Modrinth, CurseForge, and Github Releases"
Expand Down
10 changes: 1 addition & 9 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,7 @@ pub enum SubCommands {
#[clap(about("Sort all your mods in alphabetical order"))]
Sort,
#[clap(about("Download and install the latest version of the mods specified"))]
Upgrade {
#[clap(long)]
#[clap(help(
"Do not check for the full game version, only check for the major and minor versions
\rSome Minecraft versions (e.g. 1.18 & 1.18.1) are compatible with each other,
\rthis option allows you to use older, but still compatible, versions of a mod that might not have yet updated to the latest version"
))]
no_patch_check: bool,
},
Upgrade,
}

#[derive(Subcommand)]
Expand Down
50 changes: 34 additions & 16 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async fn actual_main() -> Result<()> {
subcommands::switch(&mut config, profile_name)?;
},
SubCommands::Sort => profile.mods.sort_by_cached_key(|mod_| mod_.name.clone()),
SubCommands::Upgrade { no_patch_check } => {
SubCommands::Upgrade => {
check_empty_profile(profile)?;
create_dir_all(&profile.output_dir).await?;
let mut to_download = Vec::new();
Expand All @@ -207,21 +207,39 @@ async fn actual_main() -> Result<()> {
for mod_ in &profile.mods {
use libium::config::structs::ModIdentifier;
let result: Result<Downloadable, _> = match &mod_.identifier {
ModIdentifier::CurseForgeProject(project_id) => {
upgrade::curseforge(&curseforge, profile, *project_id, no_patch_check)
.await
.map(std::convert::Into::into)
},
ModIdentifier::ModrinthProject(project_id) => {
upgrade::modrinth(&modrinth, profile, project_id, no_patch_check)
.await
.map(|ok| ok.files[0].clone().into())
},
ModIdentifier::GitHubRepository(full_name) => {
upgrade::github(&github.repos(&full_name.0, &full_name.1), profile)
.await
.map(std::convert::Into::into)
},
ModIdentifier::CurseForgeProject(project_id) => upgrade::curseforge(
&curseforge,
profile,
*project_id,
mod_.check_game_version,
mod_.check_mod_loader,
)
.await
.map(std::convert::Into::into),
ModIdentifier::ModrinthProject(project_id) => upgrade::modrinth(
&modrinth,
profile,
project_id,
mod_.check_game_version,
mod_.check_mod_loader,
)
.await
.map(|version| {
for file in &version.files {
if file.primary {
return file.clone().into();
}
}
version.files[0].clone().into()
}),
ModIdentifier::GitHubRepository(full_name) => upgrade::github(
&github.repos(&full_name.0, &full_name.1),
profile,
mod_.check_game_version,
mod_.check_mod_loader,
)
.await
.map(std::convert::Into::into),
};
match result {
Ok(result) => {
Expand Down
Loading

0 comments on commit 0475f7c

Please sign in to comment.