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 ### Available commands
- `install` or `i` - Install a mod by the file provided (directory, zip, patch); - `install` or `i` - Install a mod by the file provided (directory, zip, patch)
- `uninstall` or `u` - Uninstall a mod; - `uninstall` or `u` - Uninstall a mod
- `list` or `l` - List all installed mods; - `list` or `l` - List all installed mods
- `enable` or `e` - Enable a mod; - `enable` or `e` - Enable a mod
- `disable` or `d` - Disable a mod; - `disable` or `d` - Disable a mod
- `rename` or `r` - Rename a mod; - `rename` or `r` - Rename a mod
- `order` or `o` - Change load order for a mod; - `order` or `o` - Change load order for a mod
- `export` or `ex` - Export installed mods to a zip file; - `export` or `ex` - Export installed mods to a zip file
- `import` or `im` - Import mods from a zip file; - `import` or `im` - Import mods from a zip file
- `modpack-create` or `mc` - Create a modpack from the currently installed mods; - `m` or `modpack` - Manage modpacks (collections of mods)
- `modpack-switch` or `ms` - Switch to a modpack; - `nexus-setup` or `ns` - Setup Nexus Mods integration
- `modpack-list` or `ml` - List all installed modpacks; - `update` or `up` - Update h2mm to latest version
- `modpack-delete` or `md` - Delete a modpack; - `reset` or `rs` - Reset all installed mods
- `modpack-overwrite` or `mo` - Overwrite a modpack; - `help` or `h` - Display this help message
- `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.
### Examples ### Examples
+77 -39
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Helldivers 2 Mod Manager (h2mm) - A command-line mod manager for Helldivers 2
VERSION="0.6.16"
VERSION="0.6.15"
# --- Globals --- # --- Globals ---
@@ -371,26 +371,21 @@ function display_help_main() {
Helldivers 2 Mod Manager v${VERSION} Helldivers 2 Mod Manager v${VERSION}
Usage: h2mm [OPTION] COMMAND Usage: h2mm [OPTION] COMMAND
Commands: Commands:
i, install Install a mod by the file provided (directory, zip, patch). i, install Install a mod by the file provided (directory, zip, patch)
u, uninstall Uninstall a mod. u, uninstall Uninstall a mod
l, list List all installed mods. l, list List all installed mods
e, enable Enable a mod. e, enable Enable a mod
d, disable Disable a mod. d, disable Disable a mod
r, rename Rename a mod. r, rename Rename a mod
o, order Change load order of a mod. o, order Change load order of a mod
ex, export Export installed mods to a zip file. m, modpack Manage modpacks (collections of mods)
im, import Import mods from a zip file. ex, export Export installed mods to a zip file
mc, modpack-create Create a modpack from the currently installed mods. im, import Import mods from a zip file
ms, modpack-switch Switch to a modpack. ns, nexus-setup Setup Nexus Mods integration
ml, modpack-list List all installed modpacks. up, update Update h2mm to the latest version
mc, modpack-delete Delete a modpack. rs, reset Reset all installed mods
mo, modpack-overwrite Overwrite a modpack. help Display this help message
mr, modpack-reset Reset all installed modpacks. For more information on usage, use h2mm COMMAND --help.
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: Example:
h2mm install /path/to/mod.zip h2mm install /path/to/mod.zip
h2mm uninstall -n "Example mod" h2mm uninstall -n "Example mod"
@@ -513,6 +508,31 @@ Example:
EOF 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() { function display_help_modpack_list() {
cat << EOF cat << EOF
Usage: h2mm modpack-list Usage: h2mm modpack-list
@@ -1760,6 +1780,39 @@ function self_update() {
exit 0 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 --- # --- Nexus Mods Integration ---
function nexus_setup() { function nexus_setup() {
@@ -2040,23 +2093,8 @@ function main() {
"rename"|"r") "rename"|"r")
mod_rename "$@" mod_rename "$@"
;; ;;
"modpack-list"|"ml") "modpack"|"m")
modpack_list "$@" modpack "$@"
;;
"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 "$@"
;; ;;
"nexus-setup"|"ns") "nexus-setup"|"ns")
nexus_setup "$@" nexus_setup "$@"
+1 -1
View File
@@ -1 +1 @@
0.6.15 0.6.16