From 9a395088c9839558d9278d4e27ffeef6f590ca87 Mon Sep 17 00:00:00 2001 From: Ilesh Thiada Date: Fri, 6 May 2022 11:02:20 +0530 Subject: [PATCH] Prep for release, & small change to sort command Also, 100th commit! --- CHANGELOG.md | 1 + Cargo.lock | 10 ++++---- Cargo.toml | 2 +- README.md | 41 ++++++++++++++++++++----------- src/main.rs | 4 ++- src/subcommands/profile/create.rs | 3 +++ src/subcommands/profile/mod.rs | 17 ++++++------- 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc7a19..cad3916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - If it contains stuff, it will ask if you want to create a backup - So that you don't lose the stuff in there when you upgrade - Along with the original relative directory check +- Made sort command convert to lowercase when sorting ## `v3.25.1` diff --git a/Cargo.lock b/Cargo.lock index 5db1802..64e1780 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -318,9 +318,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.15" +version = "3.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a35a599b11c089a7f49105658d089b8f2cf0882993c17daf6de15285c2c35d" +checksum = "f52d4f8e4a1419219935762e32913b4430f37cb0c0200ad17a89ee18c0188a9f" dependencies = [ "atty", "bitflags", @@ -493,7 +493,7 @@ dependencies = [ [[package]] name = "ferium" -version = "3.25.1" +version = "3.26.0" dependencies = [ "anyhow", "bytes", @@ -1312,9 +1312,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" dependencies = [ "unicode-xid", ] diff --git a/Cargo.toml b/Cargo.toml index 2c1013f..2cbbd82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ferium" -version = "3.25.1" +version = "3.26.0" edition = "2021" authors = ["Ilesh Thiada (theRookieCoder) ", "Daniel Hauck (SolidTux)"] description = "Ferium is a CLI program for managing Minecraft mods from Modrinth, CurseForge, and Github Releases" diff --git a/README.md b/README.md index 545b1e6..4e83c0d 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,16 @@ Simply specify the mods you use through the CLI and in just one command, you can - Upgrade all your mods in one command, `ferium upgrade` - Ferium checks that the version being downloaded is the latest one compatible with the chosen mod loader and Minecraft version - Create multiple profiles and configure different mod loaders, Minecraft versions, output directories, and mods for each +- Configure overrides for mods that are not specified as compatible, but still work ## Installation Ferium is a compiled, statically linked program that does not require any external dependencies. On Linux the regular version requires GTK to be installed, but the `no-gui` version does not need this. +Ferium is coming to more package managers soon! +[Tracking Issue](https://github.com/theRookieCoder/ferium/issues/42) + ### AUR Ferium releases a no-gui version [here](https://aur.archlinux.org/packages/ferium-bin) and a version with a GUI file dialog [here](https://aur.archlinux.org/packages/ferium-gui-bin). The GUI version dependes on GTK @@ -39,6 +43,11 @@ Remember to use an add-on like [cargo-update](https://crates.io/crates/cargo-upd ## Overview / Help Page +> Note! A lot of Ferium's backend is in a seperate project [Libium](https://github.com/theRookieCoder/libium). +> It has things like the config, add, upgrade, file pickers, etc + +> The config file is located at `~/.config/ferium/config.json` if you're interested in manually editing it + ### First Startup When you first start up, you will have to create a new profile by running `ferium profile create` and entering the details for your profile. @@ -63,10 +72,12 @@ When you first start up, you will have to create a new profile by running `feri - For example [Sodium's repository](https://github.com/CaffeineMC/sodium-fabric) has the id `CaffeineMC` and `sodium-fabric` - You can find these at the top left part of the repository's page as a big 'owner / name' - So to add [Sodium](https://github.com/CaffeineMC/sodium-fabric), you should run `ferium add-github CaffeineMC sodium-fabric` (again, case-insensitive) + - Note: The GitHub repository has to release JAR files in their Releases for Ferium to download, or else it will refuse to be added ### Upgrading Mods -## _Warning: Upgrading will empty the output directory before downloading your mods!_ +> _Warning: Upgrading will empty the output directory before downloading your mods!_ +> If your output directory is not empty when setting it, Ferium will offer to create a backup Now after adding all your mods, run `ferium upgrade` to download all of them to your output directory. This defaults to `.minecraft/mods`, where `.minecraft` is the default Minecraft resources directory. You don't need to worry about this if you play with Mojang's launcher (unless you changed the resources directory). @@ -84,8 +95,10 @@ You can also provide the names of the mods to remove as arguments. Mod names wit #### Advanced -If some mod is compatible with your profile but Ferium does not download it, [create an issue]((https://github.com/theRookieCoder/ferium/issues/new)) if you think it's a bug. Or else, you can disable the game version or mod loader checks by setting `check_game_version` or `check_mod_loader` to false in the specific mod. -For example, [Just Enough Items](https://www.curseforge.com/minecraft/mc-mods/jei) does not specify the mod loader for older minecraft versions such as `1.12.2`. In this case, you would disable the mod loader check like so +If some mod is compatible with your profile but Ferium does not download it, [create an issue]((https://github.com/theRookieCoder/ferium/issues/new)) if you think it's a bug. Or else, you can disable the game version or mod loader checks by setting `check_game_version` or `check_mod_loader` to false for the specific mod. + +For example, [Just Enough Items](https://www.curseforge.com/minecraft/mc-mods/jei) does not specify the mod loader for older minecraft versions such as `1.12.2`. In this case, you would add JEI by running `ferium add-curseforge 238222 --dont-check-mod-loader` so that the mod loader check is disabled. +You can also manually disable the mod loader (and/or game version) check(s) in the config like so ```json { "name": "Just Enough Items (JEI)", @@ -107,17 +120,19 @@ You can create a profile by running `ferium profile create` and configuring the - Minecraft version - Mod loader -Ferium will automatically switch to the newly created profile. +You can also provide these settings as flags to the create command. +If you want to copy the mods from another profile, provide the `--import` flag. You can also provide the profile name to the `--import` flag, if you don't a profile picker will be shown. +Finally, Ferium will automatically switch to the newly created profile. #### Configure -You can configure these same settings afterwards by running `ferium profile configure` +You can configure these same settings afterwards by running `ferium profile configure`. +Again, you can provide these settings as flags to the command. #### Manage -You can see all the profiles you have by running `ferium -profile list`. -Switch between your profiles using `ferium profile switch`. +You can see all the profiles you have by running `ferium profile list`. +Switch between your profiles using `ferium switch`. #### Delete @@ -125,20 +140,18 @@ You can delete a profile by running `ferium profile delete` and selecting the pr ## Feature Requests -If you would like to make a feature request, check the [issues](https://github.com/theRookieCoder/ferium/issues?q=is%3Aissue) to see if the feature has already been added/planned. If not, [create a new issue](https://github.com/theRookieCoder/ferium/issues/new). +If you would like to make a feature request, check the [issues](https://github.com/theRookieCoder/ferium/issues?q=is%3Aissue) to see if the feature has already been added or is planned. If not, [create a new issue](https://github.com/theRookieCoder/ferium/issues/new). ## Building from Source or Working with Ferium -> Note; A lot of Ferium's backend is in a seperate project, [Libium](https://github.com/theRookieCoder/libium). You might want to make some edits there for things like the config, add, upgrade, etc - Firstly, you need the Rust toolchain which includes `cargo`, `rustup`, etc. You can install these from [the Rust website](https://www.rust-lang.org/tools/install). -You'll also need the [Just](https://github.com/casey/just#installation) command runner, its basically a better version of `make`. +You'll also need the [Just](https://github.com/casey/just#installation) command runner, its basically a much better version of `make`. If you want to build Ferium without cloning the repo, set the `CURSEFORGE_API_KEY` environment variable, then run `cargo install ferium`. If you don't have a CurseForge API key you can set the variable to an empty value, however anything using the CurseForge API will not work. To build the project and install it to your Cargo binary directory, clone the project and run `just install`. If you want to install it for testing a developement version, run `just` (alias for `just install-dev`). -If you want to obtain executables for a specific OS, you can run `just build-` and replace `` with `mac`, `win`, or `linux`. The produced binaries will be zipped and moved to `out/`. +If you want to obtain executables for a specific OS, you can run `just build-` and replace `` with `mac`, `win`, or `linux`. The produced binaries will be zipped and moved to `out/`. There is also `just build-linux-nogui`for building binaries that don't need GTK. -You can run clippy linters using `just lint`, and integration tests using `cargo test`. +You can run clippy linters using `just lint`, and integration tests using `cargo test`. Finally you can delete all the build and test artefacts by using `just clean`. diff --git a/src/main.rs b/src/main.rs index fa465e9..dd2ceb4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -193,7 +193,9 @@ async fn actual_main() -> Result<()> { subcommands::remove(profile, mod_names)?; }, SubCommands::Switch { profile_name } => subcommands::switch(&mut config, profile_name)?, - SubCommands::Sort => profile.mods.sort_by_cached_key(|mod_| mod_.name.clone()), + SubCommands::Sort => profile + .mods + .sort_by_cached_key(|mod_| mod_.name.to_lowercase()), SubCommands::Upgrade => { check_internet().await?; check_empty_profile(profile)?; diff --git a/src/subcommands/profile/create.rs b/src/subcommands/profile/create.rs index 84bfffb..170d13c 100644 --- a/src/subcommands/profile/create.rs +++ b/src/subcommands/profile/create.rs @@ -73,6 +73,9 @@ pub async fn create( }; if let Some(from) = import { + if config.profiles.is_empty() { + bail!("There are no profiles configured to import mods from") + } let selection = match from { // If the profile name has been provided as an option Some(profile_name) => { diff --git a/src/subcommands/profile/mod.rs b/src/subcommands/profile/mod.rs index 571cbe8..6f0be64 100644 --- a/src/subcommands/profile/mod.rs +++ b/src/subcommands/profile/mod.rs @@ -61,19 +61,18 @@ fn check_profile_name(config: &mut config::structs::Config, name: &str) -> Resul async fn check_output_directory(output_dir: &PathBuf) -> Result<()> { if output_dir.is_relative() { - bail!("The provided output directory is not absolute, i.e. it is a relative path") + bail!("The provided output directory is not absolute, i.e. it is a relative path"); } if output_dir.file_name().unwrap() != "mods" { - println!("{}", "Warning! The output directory is not called `mods`. Most mod loaders will load a directory called `mods`.".bright_yellow()) + println!("{}", "Warning! The output directory is not called `mods`. Most mod loaders will load a directory called `mods`.".bright_yellow()); } - if output_dir.exists() && read_dir(output_dir).await?.next_entry().await?.is_some() { - if Confirm::with_theme(&*THEME) + if output_dir.exists() + && read_dir(output_dir).await?.next_entry().await?.is_some() + && Confirm::with_theme(&*THEME) .with_prompt("Your output directory is not empty and it will be erased when upgrading. Would like to create a backup of it?") - .interact()? - { - let backup_dir = file_picker::pick_folder(&*HOME, "Where should the backup be made?").await.unwrap(); - copy(output_dir, backup_dir, &CopyOptions::new())?; - } + .interact()? { + let backup_dir = file_picker::pick_folder(&*HOME, "Where should the backup be made?").await.unwrap(); + copy(output_dir, backup_dir, &CopyOptions::new())?; } Ok(()) }