Skip to content

Commit

Permalink
Prep for release, & small change to sort command
Browse files Browse the repository at this point in the history
Also, 100th commit!
  • Loading branch information
theRookieCoder committed May 6, 2022
1 parent c19f6be commit 9a39508
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
10 changes: 5 additions & 5 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.25.1"
version = "3.26.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
41 changes: 27 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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).
Expand All @@ -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)",
Expand All @@ -107,38 +120,38 @@ 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

You can delete a profile by running `ferium profile delete` and selecting the profile you want to delete.

## 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-<OS>` and replace `<OS>` 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-<OS>` and replace `<OS>` 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`.
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
3 changes: 3 additions & 0 deletions src/subcommands/profile/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
17 changes: 8 additions & 9 deletions src/subcommands/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

0 comments on commit 9a39508

Please sign in to comment.