fix: modpack commands are separate (#93)

This commit is contained in:
v4n
2025-09-21 07:20:58 +03:00
committed by GitHub
parent c72ceb899e
commit 3bf4a5e542
3 changed files with 92 additions and 59 deletions
+14 -19
View File
@@ -25,25 +25,20 @@ h2mm
### Available commands
- `install` or `i` - Install a mod by the file provided (directory, zip, patch);
- `uninstall` or `u` - Uninstall a mod;
- `list` or `l` - List all installed mods;
- `enable` or `e` - Enable a mod;
- `disable` or `d` - Disable a mod;
- `rename` or `r` - Rename a mod;
- `order` or `o` - Change load order for a mod;
- `export` or `ex` - Export installed mods to a zip file;
- `import` or `im` - Import mods from a zip file;
- `modpack-create` or `mc` - Create a modpack from the currently installed mods;
- `modpack-switch` or `ms` - Switch to a modpack;
- `modpack-list` or `ml` - List all installed modpacks;
- `modpack-delete` or `md` - Delete a modpack;
- `modpack-overwrite` or `mo` - Overwrite a modpack;
- `modpack-reset` or `mr` - Reset all installed modpacks;
- `nexus-setup` or `ns` - Setup Nexus Mods integration;
- `update` or `up` - Update h2mm to latest version;
- `reset` or `rs` - Reset all installed mods;
- `help` or `h` - Display this help message.
- `install` or `i` - Install a mod by the file provided (directory, zip, patch)
- `uninstall` or `u` - Uninstall a mod
- `list` or `l` - List all installed mods
- `enable` or `e` - Enable a mod
- `disable` or `d` - Disable a mod
- `rename` or `r` - Rename a mod
- `order` or `o` - Change load order for a mod
- `export` or `ex` - Export installed mods to a zip file
- `import` or `im` - Import mods from a zip file
- `m` or `modpack` - Manage modpacks (collections of mods)
- `nexus-setup` or `ns` - Setup Nexus Mods integration
- `update` or `up` - Update h2mm to latest version
- `reset` or `rs` - Reset all installed mods
- `help` or `h` - Display this help message
### Examples
+77 -39
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Helldivers 2 Mod Manager (h2mm) - A command-line mod manager for Helldivers 2
VERSION="0.6.15"
VERSION="0.6.16"
# --- Globals ---
@@ -371,26 +371,21 @@ function display_help_main() {
Helldivers 2 Mod Manager v${VERSION}
Usage: h2mm [OPTION] COMMAND
Commands:
i, install Install a mod by the file provided (directory, zip, patch).
u, uninstall Uninstall a mod.
l, list List all installed mods.
e, enable Enable a mod.
d, disable Disable a mod.
r, rename Rename a mod.
o, order Change load order of a mod.
ex, export Export installed mods to a zip file.
im, import Import mods from a zip file.
mc, modpack-create Create a modpack from the currently installed mods.
ms, modpack-switch Switch to a modpack.
ml, modpack-list List all installed modpacks.
mc, modpack-delete Delete a modpack.
mo, modpack-overwrite Overwrite a modpack.
mr, modpack-reset Reset all installed modpacks.
ns, nexus-setup Setup Nexus Mods integration.
up, update Update h2mm to the latest version.
rs, reset Reset all installed mods.
help Display this help message.
For more information on usage, use h2mm <COMMAND> --help.
i, install Install a mod by the file provided (directory, zip, patch)
u, uninstall Uninstall a mod
l, list List all installed mods
e, enable Enable a mod
d, disable Disable a mod
r, rename Rename a mod
o, order Change load order of a mod
m, modpack Manage modpacks (collections of mods)
ex, export Export installed mods to a zip file
im, import Import mods from a zip file
ns, nexus-setup Setup Nexus Mods integration
up, update Update h2mm to the latest version
rs, reset Reset all installed mods
help Display this help message
For more information on usage, use h2mm COMMAND --help.
Example:
h2mm install /path/to/mod.zip
h2mm uninstall -n "Example mod"
@@ -513,6 +508,31 @@ Example:
EOF
}
function display_help_modpack() {
echo "Usage:"
echo " h2mm modpack [COMMAND] [OPTIONS]"
echo
echo "Description:"
echo " Manage modpacks (collections of installed mods)."
echo
echo "Commands:"
printf " %-20s %s\n" "create" "Create a modpack from current mods"
printf " %-20s %s\n" "list" "List all installed modpacks"
printf " %-20s %s\n" "switch" "Switch to a modpack"
printf " %-20s %s\n" "delete" "Delete a modpack"
printf " %-20s %s\n" "overwrite" "Overwrite an existing modpack"
printf " %-20s %s\n" "reset" "Reset all installed modpacks"
echo
echo "Options:"
printf " %-20s %s\n" "-v, --verbose" "Enable verbose output"
printf " %-20s %s\n" "-h, --help" "Show help for modpack or a subcommand"
echo
echo "Examples:"
echo " h2mm modpack create \"MyPack\""
echo " h2mm modpack switch \"MyPack\""
echo " h2mm modpack list"
}
function display_help_modpack_list() {
cat << EOF
Usage: h2mm modpack-list
@@ -1760,6 +1780,39 @@ function self_update() {
exit 0
}
function modpack() {
parse_help_has_arguments display_help_modpack "$@"
# parse arguments
case "$1" in
"list"|"l")
modpack_list "$@"
;;
"create"|"c")
modpack_create "$@"
;;
"delete"|"d")
modpack_delete "$@"
;;
"overwrite"|"o")
modpack_overwrite "$@"
;;
"switch"|"s")
modpack_switch "$@"
;;
"reset"|"r")
modpack_reset "$@"
;;
"help"|"h"|"-h"|"--help")
$display_help
;;
*)
log ERROR "Unknown command: $command"
$display_help
;;
esac
}
# --- Nexus Mods Integration ---
function nexus_setup() {
@@ -2040,23 +2093,8 @@ function main() {
"rename"|"r")
mod_rename "$@"
;;
"modpack-list"|"ml")
modpack_list "$@"
;;
"modpack-create"|"mc")
modpack_create "$@"
;;
"modpack-delete"|"md")
modpack_delete "$@"
;;
"modpack-overwrite"|"mo")
modpack_overwrite "$@"
;;
"modpack-switch"|"ms")
modpack_switch "$@"
;;
"modpack-reset"|"mr")
modpack_reset "$@"
"modpack"|"m")
modpack "$@"
;;
"nexus-setup"|"ns")
nexus_setup "$@"
+1 -1
View File
@@ -1 +1 @@
0.6.15
0.6.16