diff --git a/README.md b/README.md index 9a8c294..a3a958d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,19 @@ # Helldivers 2 Mod Manager CLI +**Thank you for the support up until now and make sure to check out Arsenal!** + +## Overview + Helldivers 2 Mod Manager CLI is a command line interface for managing Helldivers 2 mods. Since there is no Linux mod manager available and I like being a nerd by using CLI tools instead of GUIs, this project was born. ## Installation Pre-requisites: -- You must have the `unzip` package installed for `zip` archives; -- You might want to have the `unarchiver` package installed for `rar` and `7z` archives. +- The `unzip` package must be installed for ZIP archives. +- The `unarchiver` package is recommended for RAR and 7Z archives. -To install Helldivers 2 Mod Manager CLI run the following command in your terminal: +To install Helldivers 2 Mod Manager CLI run the following command in the terminal: ```bash bash -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh)" @@ -17,13 +21,15 @@ bash -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/head ## Usage -The script gets added to `/usr/local/bin/h2mm` (or `$HOME/.local/bin` on Steam Deck) and can be used by running `h2mm` in your shell, which will show the help message explaining how to use the script. +The script gets added to `/usr/local/bin/h2mm` (or `$HOME/.local/bin` on Steam Deck) and can be used by running `h2mm` in the shell, which will print the help message along with all available commands. ```bash -h2mm +h2mm --help ``` -### Available commands +To find out how to use a command, run `h2mm COMMAND --help`. This is the most up-to-date source of information about the commands. + +## Available commands - `install` or `i` - Install a mod by the file provided (directory, zip, patch) - `uninstall` or `u` - Uninstall a mod @@ -34,67 +40,32 @@ h2mm - `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) +- `modpack` or `m` - 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 - -To find out how to use a command, you can run `h2mm --help`. - -#### Install mod(s) - -```bash -h2mm install mod.zip -h2mm install /path/to/mod/directory/ -h2mm install /path/to/mod.zip /path/to/mod2.zip /path/to/mod/files # bulk install mods -h2mm install -n "Example mod" mod.patch_0 mod.patch_0.stream # -n to specify name of the mod -``` - -> It's better to be in the directory where the mod files are located, so you don't have to specify the full path everytime you're installing a mod. Open a terminal and type `cd ~/Downloads` (which will change the directory to your Downloads folder) and then run the install command with just the file names. -> -> Also, use the Tab key to autocomplete the file names, as it will help you escape special characters likes spaces or quotes. - -#### List installed mods +## Examples ```bash +h2mm install --help +h2mm install ~/Downloads/mod.zip +h2mm install ~/Downloads/mod\ files/ +h2mm install a0b1c2d3.patch_0 a0b1c2d3.patch_0.stream -n "Example mod" h2mm list -h2mm list -v # verbose mode +h2mm uninstall --index 3 +h2mm modpack create "Example modpack" +h2mm modpack switch "Example modpack" ``` -#### Uninstall a mod - -```bash -h2mm uninstall -n "Example mod" -h2mm uninstall -i 3 # by index (get the index from the list command) -``` - -#### Enable/disable mods - -```bash -h2mm enable -n "Example mod" -h2mm enable -i 3 -h2mm disable -n "Example mod" -h2mm disable -i 3 -``` - -#### Updating the script - -```bash -h2mm update -``` +> When installing, it is recommended to be in the directory where mod archives are, or to use absolute paths. Use `cd ~/Downloads` to go to the Downloads folder, and run `ls -la` to find the archives to install. Use the Tab key to auto-complete file and folder names, this helps escape spaces and special characters. +> +> Use the `--index` flag with commands that normally require a mod name to specify a mod by its index. The index can be obtained with `h2mm list`. ## Nexus Mods integration -Nexus Mods integration allows you to use the 1-click install feature of Nexus Mods (with the "Vortex" or "Mod manager download" buttons). You can set up Nexus Mods integration by running the following command: - -```bash -h2mm nexus-setup -``` - -You will be walked through the setup process, which will ask you for your Nexus Mods API key and your preferred terminal. +Nexus Mods integration allows the use the 1-click install feature of Nexus Mods (with the "Vortex" or "Mod manager download" buttons). Set up Nexus Mods integration by running `h2mm nexus-setup`. Setup includes providing the Nexus Mods API key and selecting the preferred terminal. ## Contributing diff --git a/h2mm b/h2mm index bc19294..10b23bf 100755 --- a/h2mm +++ b/h2mm @@ -1,7 +1,7 @@ #!/usr/bin/env bash -# Helldivers 2 Mod Manager (h2mm) - A command-line mod manager for Helldivers 2 +# Helldivers 2 Mod Manager CLI -VERSION="0.6.17" +VERSION="0.7.0" # --- Globals --- @@ -97,32 +97,44 @@ function get_entry_from_db_by_nexus_mod_id() { echo "$(awk -F, -v pos="$DB_MOD_NEXUS_ID_POS" -v id="$1" 'NR > 1 && $pos == id {print $0}' "$DB_FILE")" } -function parse_help_no_arguments() { +function parse_help() { display_help="$1" - [[ "$2" == "--help" || "$2" == "-h" ]] && { $display_help; exit 0; } + [[ "$2" == "ARGS" && $# -eq 2 ]] || [[ "$2" == "--help" || "$2" == "-h" ]] && { $display_help; exit 0; } } -function parse_help_has_arguments() { - display_help="$1" - [[ $# -eq 1 || "$2" == "--help" || "$2" == "-h" ]] && { $display_help; exit 0; } +function h() { + # helper function to display help for any command + local type="$1" + shift + case "$type" in + "e") # normal echo + echo -e "$*" >&2 + ;; + "c") # command mode, printf with padding + printf " %-20s %s\n" "$1" "$2" >&2 + ;; + "n") # new line + echo >&2 + ;; + esac } function log() { local type="$1" shift case "$type" in - INFO) + "INFO") [[ "$silent" == "true" ]] && return echo -e "$*" >&2 ;; - WARNING) + "WARNING") [[ "$silent" == "true" ]] && return echo -e "${ORANGE}[!]${NC} $*" >&2 ;; - ERROR) + "ERROR") echo -e "${RED}[ERROR]${NC} $*" >&2 ;; - PROMPT) + "PROMPT") echo -ne "$*" >&2 ;; *) @@ -367,237 +379,318 @@ function initialize_modpack_directories() { # --- Help Functions --- function display_help_main() { - cat << EOF -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 - 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" - h2mm list -EOF + h e "Helldivers 2 Mod Manager CLI v$VERSION" + h n + h e "Usage:" + h e " h2mm [OPTIONS] COMMAND [ARGS]" + h n + h e "Options" + h c "-h, --help" "Show this help message for any command and exit." + h n + h e "Commands:" + h e " # Mod management" + h c "i, install" "Install a mod with any combination of mod files, directories, and zip files" + h c "u, uninstall" "Uninstall a mod" + h c "l, list" "List all installed mods and their status" + h c "e, enable" "Enable a mod" + h c "d, disable" "Disable a mod" + h c "r, rename" "Rename a mod" + h c "o, order" "Change load order of a mod" + h n + h e " # Bulk management" + h c "m, modpack" "Manage user-defined modpacks (collections of installed mods)" + h c "rs, reset" "Reset all installed mods" + h c "ex, export" "Export installed mods to an archive" + h c "im, import" "Import mods from an archive" + h n + h e " # Others" + h c "ns, nexus-setup" "Setup Nexus Mods integration" + h c "up, update" "Check for updates and update h2mm" + h c "h, help" "Show this help message and exit" + h n + h e "Examples:" + h e " h2mm install --help" + h e " h2mm install ~/Downloads/mod.zip" + h e " h2mm install ~/Downloads/mod\ files/" + h e " h2mm install a0b1c2d3.patch_0 a0b1c2d3.patch_0.stream -n \"Example mod\"" + h e " h2mm list" + h e " h2mm uninstall -i 3" + h e " h2mm modpack create \"Example modpack\"" + h e " h2mm modpack switch \"Example modpack\"" } function display_help_install() { - cat << EOF -Usage: h2mm install [OPTIONS] -Install a mod with any combination of mod files, directories, and zip files. -Options: - -n "MOD_NAME" Name of the mod. - MOD_ZIPS Zip file(s) containing mod files. - MOD_FILES Mod file(s), accepts wildcards. - MOD_DIRECTORIES Directory/directories containing mod files. -Example: - h2mm install mod.zip - h2mm install /path/to/mod/directory/ - h2mm install /path/to/mod.zip /path/to/mod2.zip /path/to/mod/files # mix and match however you want - h2mm install -n "Example mod" mod.patch_0 mod.patch_0.stream # -n to specify name of the mod -EOF + h e "Usage:" + h e " h2mm install [OPTIONS] " + h n + h e "Description:" + h e " Install one or more mods from files, directories, or archives." + h e " Supports .zip, .rar, and .7z archives (requires 'unzip' or 'unar')." + h e " It is recommended to be in the directory where mod archives are, or to use absolute paths." + h e " Use 'cd ~/Downloads' to go to the Downloads folder, and run 'ls -la' to find the archives to install." + h e " Use the Tab key to auto-complete file and folder names, this helps escape spaces and special characters." + h n + h e "Options:" + h c "-n " "Specify a custom mod name (defaults to archive/folder name)" + h n + h e "Examples:" + h e " h2mm install ~/Downloads/mod.zip" + h e " h2mm install ~/Downloads/mod\ files/" + h e " h2mm install a0b1c2d3.patch_0 a0b1c2d3.patch_0.stream -n \"Example mod\"" } function display_help_uninstall() { - cat << EOF -Usage: h2mm uninstall [OPTIONS] <"MOD_NAME"|MOD_INDEX> -Uninstall a mod by name or index. -Options: - -n "MOD_NAME" Name of the mod to uninstall. - -i MOD_INDEX Index of the mod to uninstall. -Example: - h2mm uninstall -n "Example mod" - h2mm uninstall -i 3 -EOF + h e "Usage:" + h e " h2mm uninstall [OPTIONS]" + h n + h e "Description:" + h e " Uninstall a previously installed mod by name or index." + h e " Removes mod files, updates the database, and downgrades mods if necessary." + h n + h e "Options:" + h c "-i, --index " "Uninstall mod by index (see 'h2mm list')" + h c "-n, --name " "Uninstall mod by name" + h n + h e "Examples:" + h e " h2mm uninstall -i 3" + h e " h2mm uninstall -n \"Example Mod\"" } function display_help_enable() { - cat << EOF -Usage: h2mm enable [OPTIONS] <"MOD_NAME"|MOD_INDEX> -Enable a mod by name or index. -Options: - -n "MOD_NAME" Name of the mod to enable. - -i MOD_INDEX Index of the mod to enable. -Example: - h2mm enable -n "Example mod" - h2mm enable -i 3 -EOF + h e "Usage:" + h e " h2mm enable [OPTIONS]" + h n + h e "Description:" + h e " Enable a previously installed mod by name or index." + h e " This moves mod files from disabled state to active and preserves their order." + h n + h e "Options:" + h c "-i, --index " "Enable mod by index (see 'h2mm list')" + h c "-n, --name " "Enable mod by name" + h n + h e "Examples:" + h e " h2mm enable -i 3" + h e " h2mm enable -n \"Example mod\"" } function display_help_disable() { - cat << EOF -Usage: h2mm disable [OPTIONS] <"MOD_NAME"|MOD_INDEX> -Disable a mod by name or index. -Options: - -n "MOD_NAME" Name of the mod to disable. - -i MOD_INDEX Index of the mod to disable. -Example: - h2mm disable -n "Example mod" - h2mm disable -i 3 -EOF + h e "Usage:" + h e " h2mm disable [OPTIONS]" + h n + h e "Description:" + h e " Disable a previously enabled mod by name or index." + h e " This renames mod files to mark them as disabled and updates the database." + h n + h e "Options:" + h c "-i, --index " "Disable mod by index (see 'h2mm list')" + h c "-n, --name " "Disable mod by name" + h n + h e "Examples:" + h e " h2mm disable -i 3" + h e " h2mm disable -n \"Example mod\"" } function display_help_list() { - cat << EOF -Usage: h2mm list -Database of mods is stored in Steam/steamapps/common/Helldivers\ 2/data/mods.csv -You can rename, delete, or edit this file to manage mods manually. -Options: - -v Verbose mode. -EOF + h e "Usage:" + h e " h2mm list [OPTIONS]" + h n + h e "Description:" + h e " List all installed mods, showing their status, type (LOCAL or NEXUS)," + h e " and optionally more details in verbose mode." + h e " The database of installed mods is stored in the game directory under data/mods.csv" + h n + h e "Options:" + h c "-v, --verbose" "Show detailed information including mod files and Nexus IDs" } function display_help_reset() { - cat << EOF -Usage: h2mm reset -Reset all installed mods. -Deletes all installed mods/modpacks and the database file. -Database of mods is stored in Steam/steamapps/common/Helldivers 2/data/mods.csv, along with the mods. -EOF + h e "Usage:" + h e " h2mm reset [OPTIONS]" + h n + h e "Description:" + h e " Reset all installed mods by deleting their files and clearing the database." + h e " Does not reset modpacks, use 'h2mm modpack reset' for that." + h e " This operation is irreversible, use with caution." + h n + h e "Options:" + h c "--no-path-reset" "Do not reset the H2 path file when resetting mods" } + function display_help_export() { - cat << EOF -Usage: h2mm export -Export installed mods, modpacks and database to a zip file (in h2mm format - archive with csv) in the current working directory. -EOF + h e "Usage:" + h e " h2mm export [OPTIONS]" + h n + h e "Description:" + h e " Export all installed mods to a compressed archive." + h e " The archive is saved to the backups directory (\$HOME/.h2mm/backups)." } function display_help_import() { - cat << EOF -Usage: h2mm import -Import mods, modpacks and database from an archive file (coming from h2mm). -EOF + h e "Usage:" + h e " h2mm import [OPTIONS] " + h n + h e "Description:" + h e " Import mods from a compressed archive." + h e " Importing resets existing mods before applying the archive, modpacks are preserved." + h n + h e "Examples:" + h e " h2mm import ~/.h2mm/config/backups/HD2-Mods-2025-12-12_15-00-00.tar.gz" } function display_help_order() { - cat << EOF -Usage: h2mm order [OPTIONS] <"MOD_NAME"|MOD_INDEX> -Change order of a mod by name or index. -Options: - -i index Index of the mod to order. - -n "MOD_NAME" Name of the mod to order. -Example: - h2mm order -n "Example mod" 6 - h2mm order -i 3 6 -EOF + h e "Usage:" + h e " h2mm order [OPTIONS] " + h n + h e "Description:" + h e " Change the load order of an installed mod." + h e " Mods can be reindexed by name or index to ensure correct load priority." + h n + h e "Options:" + h c "-i, --index " "Specify the mod by its current index (see 'h2mm list')" + h c "-n, --name " "Specify the mod by name" + h n + h e "Arguments:" + h c "" "The new load order index for the mod" + h n + h e "Examples:" + h e " h2mm order -i 3 1" + h e " h2mm order -n \"Example mod\" 2" } function display_help_rename() { - cat << EOF -Usage: h2mm rename [OPTIONS] <"MOD_NAME"|MOD_INDEX> -Rename a mod by name or index. -Options: - -n "MOD_NAME" Name of the mod to rename. - -i MOD_INDEX Index of the mod to rename. -Example: - h2mm rename -n "Example mod" "New mod name" - h2mm rename -i 3 "New mod name" -EOF + h e "Usage:" + h e " h2mm rename [OPTIONS] " + h n + h e "Description:" + h e " Rename an installed mod." + h n + h e "Options:" + h c "-i, --index " "Specify the mod by its current index (see 'h2mm list')" + h c "-n, --name " "Specify the mod by current name" + h n + h e "Arguments:" + h c "" "The new name for the mod" + h n + h e "Examples:" + h e " h2mm rename -i 3 \"New mod name\"" + h e " h2mm rename -n \"Old mod name\" \"New mod name\"" } 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" + h e "Usage:" + h e " h2mm modpack COMMAND [ARGS]" + h n + h e "Description:" + h e " Manage user-defined modpacks (collections of installed mods)." + h n + h e "Commands:" + h c "list, l" "List all installed modpacks" + h c "create, c" "Create a new modpack from currently installed mods" + h c "delete, d" "Delete a modpack" + h c "overwrite, o" "Overwrite an existing modpack" + h c "switch, s" "Switch to a different modpack" + h c "reset, rs" "Reset all installed modpacks" + h c "help, h" "Show this help message and exit" + h n + h e "Examples:" + h e " h2mm modpack list" + h e " h2mm modpack create \"Example modpack\"" + h e " h2mm modpack switch -n \"Example modpack\"" } function display_help_modpack_list() { - cat << EOF -Usage: h2mm modpack-list -List all installed modpacks. -Database of modpacks is stored in Steam/steamapps/common/Helldivers\ 2/data/modpacks/modpacks.csv -You can rename, delete, or edit this file to manage modpacks manually. -Options: - -v Verbose mode. -EOF + h e "Usage:" + h e " h2mm modpack list [OPTIONS]" + h n + h e "Description:" + h e " List all saved modpacks." + h e " Database of modpacks is stored in the game directory under data/modpacks/modpack.csv" + h n + h e "Options:" + h c "-v, --verbose" "Show detailed contents of each modpack" } function display_help_modpack_create() { - cat << EOF -Usage: h2mm modpack-create -n "MODPACK_NAME" -Create a modpack from a range of mods specified after command is called. -EOF + h e "Usage:" + h e " h2mm modpack create -n " + h n + h e "Description:" + h e " Create a new modpack by selecting installed mods." + h n + h e "Options:" + h c "-n " "Name of the modpack to create (required)" + h n + h e "Examples:" + h e " h2mm modpack create -n \"Example modpack\"" } function display_help_modpack_switch() { - cat << EOF -Usage: h2mm modpack-switch [OPTIONS] <"MODPACK_NAME"|MODPACK_INDEX> -Switch to a modpack by name or index. -Options: - -n "MODPACK_NAME" Name of the modpack to switch to. - -i index Index of the modpack to switch to. -EOF + h e "Usage:" + h e " h2mm modpack switch [OPTIONS]" + h n + h e "Description:" + h e " Switch to a saved modpack. This will reset the current mods and apply the selected modpack." + h n + h e "Options:" + h c "-i, --index " "Index of the modpack to switch to" + h c "-n, --name " "Name of the modpack to switch to" + h n + h e "Examples:" + h e " h2mm modpack switch -i 2" + h e " h2mm modpack switch -n \"Example modpack\"" } function display_help_modpack_reset() { - cat << EOF -Usage: h2mm modpack-reset -Reset all installed modpacks. -Deletes all installed modpacks and the database file. -Database of modpacks is stored in Steam/steamapps/common/Helldivers\ 2/data/modpacks/modpacks.csv, along with the modpacks. -EOF + h e "Usage:" + h e " h2mm modpack reset" + h n + h e "Description:" + h e " Reset all saved modpacks. This will delete all modpack archives and the modpack database." } function display_help_modpack_delete() { - cat << EOF -Usage: h2mm modpack-delete [OPTIONS] <"MODPACK_NAME"|MODPACK_INDEX> -Delete a modpack by name or index. -Options: - -n "MODPACK_NAME" Name of the modpack to delete. - -i index Index of the modpack to delete. -EOF + h e "Usage:" + h e " h2mm modpack delete [OPTIONS]" + h n + h e "Description:" + h e " Delete a saved modpack by name or index. This will remove the modpack archive and its database entry." + h n + h e "Options:" + h e " -i, --index Index of the modpack to delete." + h e " -n, --name Name of the modpack to delete." + h n + h e "Examples:" + h e " h2mm modpack delete -i 2" + h e " h2mm modpack delete -n \"Example modpack\"" } function display_help_modpack_overwrite() { - cat << EOF -Usage: h2mm modpack-overwrite [OPTIONS] <"MODPACK_NAME"|MODPACK_INDEX> -Overwrite a modpack (the mods that it uses) by name or index. -Options: - -n "MODPACK_NAME" Name of the modpack to overwrite. - -i index Index of the modpack to overwrite. -EOF + h e "Usage:" + h e " h2mm modpack overwrite [OPTIONS]" + h n + h e "Description:" + h e " Overwrite an existing modpack with the currently installed mods." + h n + h e "Options:" + h c "-n, --name " "Name of the modpack to overwrite" + h c "-i, --index " "Index of the modpack to overwrite" + h n + h e "Examples:" + h e " h2mm modpack overwrite -n \"Example modpack\"" + h e " h2mm modpack overwrite -i 2" } function display_help_nexus_setup() { - cat << EOF -Usage: h2mm nexus-setup -Setup nexusmods integration. -This will create a config file in ~/.config/h2mm/apikey with the API key. -This will create a desktop entry in ~/.local/share/applications/h2mm.desktop. -Run this again in case you change the API key or want to change the desktop entry. -EOF + h e "Usage:" + h e " h2mm nexus-setup" + h n + h e "Description:" + h e " Run the setup wizard to configure Nexus Mods integration for h2mm." + h e " You will need to provide your Nexus Mods API key and configure a terminal for the desktop entry." + h e " This command creates a file containing your API key at ~/.config/h2mm/apikey." + h e " This command creates a desktop entry at ~/.local/share/applications/h2mm.desktop." + h e " If you change your API key or want to change the terminal, run this command again." } # --- Main Functions --- @@ -655,7 +748,7 @@ function downgrade_mods() { } function mod_enable() { - parse_help_has_arguments display_help_enable "$@" + parse_help display_help_enable ARGS "$@" local mod_name="" local mod_index="" @@ -728,7 +821,7 @@ function mod_enable() { } function mod_disable() { - parse_help_has_arguments display_help_disable "$@" + parse_help display_help_disable ARGS "$@" local mod_name="" local mod_index="" @@ -793,7 +886,7 @@ function mod_disable() { } function mod_reset() { - parse_help_no_arguments display_help_reset "$@" + parse_help display_help_reset "$@" local no_path_reset=false; [[ "$1" == "--no-path-reset" ]] && no_path_reset=true log PROMPT "Are you sure you want to ${RED}reset${NC} all installed mods? (Y/n): " @@ -811,7 +904,7 @@ function mod_reset() { } function mod_install() { - parse_help_has_arguments display_help_install "$@" + parse_help display_help_install ARGS "$@" local mod_name="" local mod_dir=() local mod_files=() @@ -1085,7 +1178,7 @@ function mod_install() { } function mod_uninstall() { - parse_help_has_arguments display_help_uninstall "$@" + parse_help display_help_uninstall ARGS "$@" local mod_name="" local mod_index="" @@ -1142,7 +1235,7 @@ function mod_uninstall() { } function mod_list() { - parse_help_no_arguments display_help_list "$@" + parse_help display_help_list "$@" local verbose=false # parse arguments @@ -1190,7 +1283,7 @@ function mod_list() { } function mod_export() { - parse_help_no_arguments display_help_export "$@" + parse_help display_help_export "$@" local save_dir=${BACKUPS_DIR} local archive_name="HD2-Mods-$(date +%Y-%m-%d_%H-%M-%S)" local modpack_export=false @@ -1246,7 +1339,7 @@ function mod_export() { } function mod_import() { - parse_help_has_arguments display_help_import "$@" + parse_help display_help_import ARGS "$@" local modpack=false; [[ "$1" == "--modpack" ]] && { modpack=true; shift 1; } # check if the file exists @@ -1305,7 +1398,7 @@ function mod_import() { } function mod_order { - parse_help_has_arguments display_help_order "$@" + parse_help display_help_order ARGS "$@" local mod_name="" local mod_index="" local new_index="" @@ -1471,7 +1564,7 @@ function mod_order { } function mod_rename() { - parse_help_has_arguments display_help_rename "$@" + parse_help display_help_rename ARGS "$@" local mod_name="" local new_mod_name="" local mod_index="" @@ -1514,8 +1607,43 @@ function mod_rename() { # --- Modpack management --- +function modpack() { + parse_help display_help_modpack ARGS "$@" + local type="$1" + shift + + # parse arguments + case "$type" in + "list"|"l") + modpack_list "$@" + ;; + "create"|"c") + modpack_create "$@" + ;; + "delete"|"d") + modpack_delete "$@" + ;; + "overwrite"|"o") + modpack_overwrite "$@" + ;; + "switch"|"s") + modpack_switch "$@" + ;; + "reset"|"rs") + modpack_reset "$@" + ;; + "help"|"h"|"-h"|"--help") + $display_help + ;; + *) + log ERROR "Unknown command: $command" + $display_help + ;; + esac +} + function modpack_list() { - parse_help_no_arguments display_help_modpack_list "$@" + parse_help display_help_modpack_list "$@" local verbose=false # parse arguments @@ -1560,7 +1688,7 @@ function modpack_list() { } function modpack_create() { - parse_help_has_arguments display_help_modpack_create "$@" + parse_help display_help_modpack_create ARGS "$@" local modpack_name="" # parse arguments @@ -1637,7 +1765,7 @@ function modpack_create() { } function modpack_switch() { - parse_help_has_arguments display_help_modpack_switch "$@" + parse_help display_help_modpack_switch ARGS "$@" local modpack_name="" local modpack_index="" @@ -1674,7 +1802,7 @@ function modpack_switch() { } function modpack_reset() { - parse_help_no_arguments display_help_modpack_reset "$@" + parse_help display_help_modpack_reset "$@" log PROMPT "Are you sure you want to ${RED}reset${NC} all installed modpacks? (Y/n): " read confirm @@ -1692,7 +1820,7 @@ function modpack_reset() { } function modpack_delete() { - parse_help_has_arguments display_help_modpack_delete "$@" + parse_help display_help_modpack_delete ARGS "$@" local modpack_name="" local modpack_index="" @@ -1727,7 +1855,7 @@ function modpack_delete() { } function modpack_overwrite() { - parse_help_has_arguments display_help_modpack_overwrite "$@" + parse_help display_help_modpack_overwrite ARGS "$@" local modpack_name="" local modpack_index="" @@ -1780,6 +1908,7 @@ function self_update() { exit 0 } +======= function modpack() { parse_help_has_arguments display_help_modpack "$@" local type="$1" @@ -1818,7 +1947,7 @@ function modpack() { # --- Nexus Mods Integration --- function nexus_setup() { - parse_help_no_arguments display_help_nexus_setup "$@" + parse_help display_help_nexus_setup "$@" local nexus_api_key="" log INFO "This is the setup wizard for the ${ORANGE}Nexus Mods${NC} integration." @@ -2059,7 +2188,7 @@ function check_for_h2mm_update() { # --- Main --- function main() { - parse_help_has_arguments display_help_main "$@" + parse_help display_help_main ARGS "$@" command="$1"; shift diff --git a/install.sh b/install.sh index 7ceec43..ff4212a 100755 --- a/install.sh +++ b/install.sh @@ -202,3 +202,10 @@ log INFO "Use the mod manager by running 'h2mm' in your terminal." log INFO "View the changelogs: https://github.com/v4n00/h2mm-cli/releases/latest" log INFO "Check out the ${ORANGE}Nexus Mods integration${NC} by running 'h2mm nexus-setup'." log INFO "Made with <3 by v4n and contributors." +log INFO "" +log INFO "${RED}Special announcement:${NC}" +log INFO "The Helldivers 2 Mod Manager CLI is now deprecated in favor of the Arsenal Mod Manager." +log INFO "Check it out here: https://www.nexusmods.com/helldivers2/mods/4664" +log INFO "The Arsenal Mod Manager has a GUI and is more user friendly," +log INFO "making it the preferred choice for most users, especially since it now works on Linux!" +log INFO "Thank you for using the Helldivers 2 Mod Manager CLI, and we hope to see you on the Arsenal Mod Manager!" diff --git a/version b/version index fa20946..faef31a 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.6.17 +0.7.0