Skip to content

Commit 4e1459e

Browse files
Fix #65, one add command for all source
Fix #74, support for shell auto completions Fix #102 Improve command help messages
1 parent 5657657 commit 4e1459e

File tree

8 files changed

+195
-167
lines changed

8 files changed

+195
-167
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog for Ferium
22

3+
## `v4.1.0`
4+
### 31.05.2022
5+
6+
- [#65](https://github.com/gorilla-devs/ferium/issues/65) Adding mods and modpacks is now done with one command
7+
- Fixed [#102](https://github.com/gorilla-devs/ferium/issues/102)
8+
- [#74](https://github.com/gorilla-devs/ferium/issues/74) Added `complete` command to generate shell auto completions
9+
- Improved command help messages
10+
311
## `v4.0.3`
412
### 30.05.2022
513

Cargo.lock

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
[package]
22
name = "ferium"
3-
version = "4.0.3"
3+
version = "4.1.0"
44
edition = "2021"
5-
authors = ["Ilesh Thiada (theRookieCoder) <[email protected]>", "薛詠謙 (KyleUltimate)", "Daniel Hauck (SolidTux)"]
5+
authors = [
6+
"Ilesh Thiada (theRookieCoder) <[email protected]>",
7+
"薛詠謙 (KyleUltimate)",
8+
"Daniel Hauck (SolidTux)",
9+
]
610
description = "Fast CLI program for managing Minecraft mods and modpacks from Modrinth, CurseForge, and Github Releases"
711
exclude = ["tests"] # Don't need tests for installing using crates.io
812
repository = "https://github.com/gorilla-devs/ferium"
913
categories = ["command-line-utilities"]
1014
readme = "README.md"
1115
license = "MPL-2.0"
12-
keywords = [
13-
"minecraft",
14-
"mod-manager",
15-
"modrinth",
16-
"curseforge",
17-
"github"
18-
]
16+
keywords = ["minecraft", "mod-manager", "modrinth", "curseforge", "github"]
1917

2018
[features]
2119
default = ["gtk"]
2220
gtk = ["libium/gtk"]
2321
xdg = ["libium/xdg"]
2422

2523
[dependencies]
26-
tokio = { version = "1.18.2", default-features = false, features = ["rt-multi-thread", "macros"] }
27-
reqwest = { version = "0.11.10", default-features = false, features = ["rustls-tls"] }
28-
octocrab = { version = "0.16.0", default-features = false, features = ["rustls"] }
24+
tokio = { version = "1.18.2", default-features = false, features = [
25+
"rt-multi-thread",
26+
"macros",
27+
] }
28+
reqwest = { version = "0.11.10", default-features = false, features = [
29+
"rustls-tls",
30+
] }
31+
octocrab = { version = "0.16.0", default-features = false, features = [
32+
"rustls",
33+
] }
2934
clap = { version = "3.1.18", features = ["derive"] }
35+
clap_complete = "3.1.4"
3036
lazy_static = "1.4.0"
3137
serde_json = "1.0.81"
3238
dialoguer = "0.10.1"

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,46 +75,46 @@ Remember to use an add-on like [cargo-update](https://crates.io/crates/cargo-upd
7575
When you first start up Ferium, you will have to either
7676

7777
- Create a new profile by running `ferium profile create` and entering the details for your profile
78-
- Add a modpack by running `ferium modpack add-curseforge <project-id>` or `ferium modpack add-modrinth <project-id>`
78+
- Add a modpack by running `ferium modpack add <project_id>`
7979

8080
### Adding Mods
8181

8282
- Modrinth Mods
83-
- `ferium add-modrinth project_id`
83+
- `ferium add project_id`
8484
- Where `project_id` is the slug or project id of the mod
8585
- For example, [Sodium](https://modrinth.com/mod/sodium) has the slug `sodium` and a project id `AANobbMI`
8686
- You can find the slug in the website url (`modrinth.com/mod/<slug>`), and the project id at the bottom of the left sidebar under 'Technical information'
87-
- So to add [Sodium](https://modrinth.com/mod/sodium), you should run `ferium add-modrinth sodium` or `ferium add-modrinth AANobbMI`
87+
- So to add [Sodium](https://modrinth.com/mod/sodium), you should run `ferium add sodium` or `ferium add AANobbMI`
8888
- CurseForge Mods
89-
- `ferium add-curseforge project_id`
89+
- `ferium add project_id`
9090
- Where `project_id` is the project id of the mod
9191
- For example, [Terralith](https://www.curseforge.com/minecraft/mc-mods/terralith) has a project id `513688`
9292
- You can find the project id at the top of the right sidebar under 'About Project'
93-
- So to add [Terralith](https://www.curseforge.com/minecraft/mc-mods/terralith), you should run `ferium add-curseforge 513688`
93+
- So to add [Terralith](https://www.curseforge.com/minecraft/mc-mods/terralith), you should run `ferium add 513688`
9494
- GitHub 'Mods'
95-
- `ferium add-github owner/name`
95+
- `ferium add owner/name`
9696
- Where `owner` is the username of the owner of the repository and `name` is the name of the repository (both case-insensitive)
9797
- For example [Sodium's repository](https://github.com/CaffeineMC/sodium-fabric) has the id `CaffeineMC/sodium-fabric`
9898
- You can find these at the top left part of the repository's page as a big 'owner / name'
99-
- So to add [Sodium](https://github.com/CaffeineMC/sodium-fabric), you should run `ferium add-github CaffeineMC/sodium-fabric` (again, case-insensitive)
99+
- So to add [Sodium](https://github.com/CaffeineMC/sodium-fabric), you should run `ferium add CaffeineMC/sodium-fabric` (again, case-insensitive)
100100
- Note: The GitHub repository has to release JAR files in their Releases for Ferium to download, or else it will refuse to be added
101101
- External mods
102102
- If you want to use files that are not downloadable by Ferium, place them in the `user` folder in the output directory. Files here will be copied to the output directory when upgrading
103103

104104
### Adding Modpacks
105105

106106
- Modrinth Modpacks
107-
- `ferium modpack add-modrinth project_id`
107+
- `ferium modpack add project_id`
108108
- Where `project_id` is the slug or project id of the modpack
109109
- For example, [Better Minecraft](https://modrinth.com/modpack/better-minecraft) has the slug `better-minecraft` and a project id `shFhR8Vx`
110110
- You can find the slug in the website url (`modrinth.com/modpack/<slug>`), and the project id at the bottom of the left sidebar under 'Technical information'
111-
- So to add [Better Minecraft](https://modrinth.com/modpack/better-minecraft), you should run `ferium modpack add-modrinth better-minecraft` or `ferium add-modrinth shFhR8Vx`
111+
- So to add [Better Minecraft](https://modrinth.com/modpack/better-minecraft), you should run `ferium modpack add better-minecraft` or `ferium modpack add shFhR8Vx`
112112
- CurseForge Mods
113-
- `ferium modpack add-curseforge project_id`
113+
- `ferium modpack add project_id`
114114
- Where `project_id` is the project id of the modpack
115115
- For example, [RLCraft](https://www.curseforge.com/minecraft/modpacks/rlcraft) has a project id `285109`
116116
- You can find the project id at the top of the right sidebar under 'About Project'
117-
- So to add [RLCraft](https://www.curseforge.com/minecraft/modpacks/rlcraft), you should run `ferium modpack add-curseforge 285109`
117+
- So to add [RLCraft](https://www.curseforge.com/minecraft/modpacks/rlcraft), you should run `ferium modpack add 285109`
118118

119119
### Upgrading Mods
120120

@@ -151,7 +151,7 @@ You can also provide the names of the mods to remove as arguments. Mod names wit
151151

152152
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. You can disable the game version or mod loader checks by using the `--dont-check-game-version` and/or `--dont-check-mod-loader` flags when adding the mod, or manually setting `check_game_version` or `check_mod_loader` to false for the specific mod in the config.
153153

154-
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.
154+
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 238222 --dont-check-mod-loader` so that the mod loader check is disabled.
155155
You can also manually disable the mod loader (and/or game version) check(s) in the config like so
156156
```json
157157
{

src/cli.rs

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use clap::{Parser, Subcommand, ValueHint};
2+
use clap_complete::Shell;
23
use std::path::PathBuf;
34

45
#[derive(Parser)]
@@ -12,7 +13,7 @@ pub struct Ferium {
1213
#[clap(help("The limit for additional threads spawned by the Tokio runtime"))]
1314
pub threads: Option<usize>,
1415
#[clap(long)]
15-
#[clap(help("A GitHub personal access token for increasing the rate limit"))]
16+
#[clap(help("A GitHub personal access token for increasing the GitHub API rate limit"))]
1617
pub github_token: Option<String>,
1718
#[clap(long)]
1819
#[clap(help(
@@ -24,44 +25,27 @@ pub struct Ferium {
2425

2526
#[derive(Subcommand)]
2627
pub enum SubCommands {
27-
#[clap(about("Add a Modrinth mod to the profile"))]
28-
AddModrinth {
29-
#[clap(help("The project ID is specified at the bottom of the left sidebar under 'Technical information'\nYou can also use the project slug for this"))]
30-
project_id: String,
31-
#[clap(long)]
32-
#[clap(help("Whether the game version should be checked for this mod"))]
28+
#[clap(about("Add a mod to the profile"))]
29+
Add {
30+
#[clap(help("The identifier of the mod/project/repository
31+
The Modrinth project ID is specified at the bottom of the left sidebar under 'Technical information'. You can also use the project slug in the URL
32+
The CurseForge mod ID is specified at the top of the right sidebar under 'About Project'
33+
The GitHub identifier is the repository's full name, e.g. `gorilla-devs/ferium`"))]
34+
identifier: String,
35+
#[clap(long)]
36+
#[clap(help("The game version will not be checked for this mod"))]
3337
dont_check_game_version: bool,
3438
#[clap(long)]
35-
#[clap(help("Whether the mod loader should be checked for this mod"))]
39+
#[clap(help("The mod loader will not be checked for this mod"))]
3640
dont_check_mod_loader: bool,
3741
#[clap(long)]
38-
#[clap(help("Do not add any of the mod's dependencies"))]
42+
#[clap(help("The mod's dependencies will not be added"))]
3943
dont_add_dependencies: bool,
4044
},
41-
#[clap(about("Add a GitHub repository to the profile"))]
42-
AddGithub {
43-
#[clap(help("The full name of the repository, e.g. `theRookieCoder/ferium`"))]
44-
name: String,
45-
#[clap(long)]
46-
#[clap(help("Whether the game version should be checked for this mod"))]
47-
dont_check_game_version: bool,
48-
#[clap(long)]
49-
#[clap(help("Whether the mod loader should be checked for this mod"))]
50-
dont_check_mod_loader: bool,
51-
},
52-
#[clap(about("Add a CurseForge mod to the profile"))]
53-
AddCurseforge {
54-
#[clap(help("The project ID is specified at the right sidebar under 'About Project'"))]
55-
project_id: i32,
56-
#[clap(long)]
57-
#[clap(help("Whether the game version should be checked for this mod"))]
58-
dont_check_game_version: bool,
59-
#[clap(long)]
60-
#[clap(help("Whether the mod loader should be checked for this mod"))]
61-
dont_check_mod_loader: bool,
62-
#[clap(long)]
63-
#[clap(help("Do not add any of the mod's dependencies"))]
64-
dont_add_dependencies: bool,
45+
#[clap(about("Generate shell auto completions to stdout for the specified shell"))]
46+
Complete {
47+
#[clap(help("The shell to generate auto completions for"))]
48+
shell: Shell,
6549
},
6650
#[clap(about("List all the mods in the profile, and with some their metadata if verbose"))]
6751
List {
@@ -81,10 +65,13 @@ pub enum SubCommands {
8165
#[clap(subcommand)]
8266
subcommand: ProfileSubCommands,
8367
},
84-
#[clap(about("Remove a mod or repository from the profile\nOptionally, provide a list of names of the mods to remove"))]
68+
#[clap(about(
69+
"Remove a mod or repository from the profile
70+
Optionally, provide a list of names of the mods to remove"
71+
))]
8572
Remove {
8673
#[clap(name("mod-name"))]
87-
#[clap(help("A case-insensitive list of names of a mods to remove\nIf one or more of the mod names provided does not exist, the program will error out without changing anything in the config"))]
74+
#[clap(help("A case-insensitive list of names of a mods to remove"))]
8875
mod_names: Vec<String>,
8976
},
9077
#[clap(about("Sort all your mods in alphabetical order"))]
@@ -96,7 +83,8 @@ pub enum SubCommands {
9683
#[derive(Subcommand)]
9784
pub enum ProfileSubCommands {
9885
#[clap(about(
99-
"Configure the current profile's Minecraft version, mod loader, and output directory\nOptionally, provide setting(s) to change as option(s)"
86+
"Configure the current profile's Minecraft version, mod loader, and output directory
87+
Optionally, provide setting(s) to change as option(s)"
10088
))]
10189
Configure {
10290
#[clap(long)]
@@ -114,11 +102,18 @@ pub enum ProfileSubCommands {
114102
#[clap(help("The directory to output mods to"))]
115103
output_dir: Option<PathBuf>,
116104
},
117-
#[clap(about("Create a new profile\nOptionally, provide ALL the options to create the profile without the UI"))]
105+
#[clap(about(
106+
"Create a new profile
107+
Optionally provide all the options, to create the profile without the UI
108+
Use the import flag to import mods from another profile"
109+
))]
118110
Create {
119111
#[clap(long)]
120112
#[allow(clippy::option_option)]
121-
#[clap(help("Copy over the mods from an existing profile\nOptionally, provide the name of the profile to import mods from"))]
113+
#[clap(help(
114+
"Copy over the mods from an existing profile
115+
Optionally, provide the name of the profile to import mods from"
116+
))]
122117
import: Option<Option<String>>,
123118
#[clap(long)]
124119
#[clap(help("The Minecraft version to check compatibility for"))]
@@ -135,15 +130,21 @@ pub enum ProfileSubCommands {
135130
#[clap(help("The directory to output mods to"))]
136131
output_dir: Option<PathBuf>,
137132
},
138-
#[clap(about("Delete a profile\nOptionally, provide the name of the profile to delete\nAfter deletion, the first profile will be selected"))]
133+
#[clap(about(
134+
"Delete a profile
135+
Optionally, provide the name of the profile to delete"
136+
))]
139137
Delete {
140138
#[clap(long)]
141139
#[clap(help("The name of the profile to delete"))]
142140
profile_name: Option<String>,
143141
},
144142
#[clap(about("List all the profiles with their data"))]
145143
List,
146-
#[clap(about("Switch between different profiles\nOptionally, provide the name of the profile to switch to"))]
144+
#[clap(about(
145+
"Switch between different profiles
146+
Optionally, provide the name of the profile to switch to"
147+
))]
147148
Switch {
148149
#[clap(long)]
149150
#[clap(help("The name of the profile to switch to"))]
@@ -153,51 +154,54 @@ pub enum ProfileSubCommands {
153154

154155
#[derive(Subcommand)]
155156
pub enum ModpackSubCommands {
156-
#[clap(about("Add a Modrinth modpack to the config"))]
157-
AddModrinth {
158-
#[clap(help("The project ID is specified at the bottom of the left sidebar under 'Technical information'\nYou can also use the project slug for this"))]
159-
project_id: String,
157+
#[clap(about("Add a modpack to the config"))]
158+
Add {
159+
#[clap(help("The identifier of the modpack/project
160+
The Modrinth project ID is specified at the bottom of the left sidebar under 'Technical information'. You can also use the project slug for this
161+
The CurseForge mod ID is specified at the top of the right sidebar under 'About Project'"))]
162+
identifier: String,
160163
#[clap(long)]
161164
#[clap(value_hint(ValueHint::DirPath))]
162165
#[clap(help("The Minecraft instance directory to install the modpack to"))]
163166
output_dir: Option<PathBuf>,
164167
#[clap(long)]
165-
#[clap(help("Whether to install the modpack's overrides to the output directory.\nThis will override existing files"))]
166-
install_overrides: Option<bool>,
167-
},
168-
#[clap(about("Add a CurseForge modpack to the config"))]
169-
AddCurseforge {
170-
#[clap(help("The project ID is specified at the right sidebar under 'About Project'"))]
171-
project_id: i32,
172-
#[clap(long)]
173-
#[clap(value_hint(ValueHint::DirPath))]
174-
#[clap(help("The Minecraft instance directory to install the modpack to"))]
175-
output_dir: Option<PathBuf>,
176-
#[clap(long)]
177-
#[clap(help("Whether to install the modpack's overrides to the output directory.\nThis may overwrite existing files"))]
168+
#[clap(help(
169+
"Whether to install the modpack's overrides to the output directory
170+
This will override existing files"
171+
))]
178172
install_overrides: Option<bool>,
179173
},
180174
#[clap(about(
181-
"Configure the current modpack's output directory\nOptionally, provide the output directory as an option"
175+
"Configure the current modpack's output directory
176+
Optionally, provide the output directory as an option"
182177
))]
183178
Configure {
184179
#[clap(long)]
185180
#[clap(value_hint(ValueHint::DirPath))]
186181
#[clap(help("The Minecraft instance directory to install the modpack to"))]
187182
output_dir: Option<PathBuf>,
188183
#[clap(long)]
189-
#[clap(help("Whether to install the modpack's overrides to the output directory.\nThis may overwrite existing files"))]
184+
#[clap(help(
185+
"Whether to install the modpack's overrides to the output directory
186+
This may overwrite existing files"
187+
))]
190188
install_overrides: Option<bool>,
191189
},
192-
#[clap(about("Delete a modpack\nOptionally, provide the name of the modpack to delete"))]
190+
#[clap(about(
191+
"Delete a modpack
192+
Optionally, provide the name of the modpack to delete"
193+
))]
193194
Delete {
194195
#[clap(long)]
195196
#[clap(help("The name of the modpack to delete"))]
196197
modpack_name: Option<String>,
197198
},
198199
#[clap(about("List all the modpacks"))]
199200
List,
200-
#[clap(about("Switch between different modpacks\nOptionally, provide the name of the modpack to switch to"))]
201+
#[clap(about(
202+
"Switch between different modpacks
203+
Optionally, provide the name of the modpack to switch to"
204+
))]
201205
Switch {
202206
#[clap(long)]
203207
#[clap(help("The name of the modpack to switch to"))]

0 commit comments

Comments
 (0)