docs: improve (#95)

* docs: rewrite help commands

* docs: rewrite README.md

* docs: remove you language

* refactor: started parse refactor
This commit is contained in:
v4n
2025-09-29 21:18:54 +03:00
committed by GitHub
parent 687bdf6709
commit 87ec07b10a
4 changed files with 368 additions and 261 deletions
+25 -54
View File
@@ -1,15 +1,19 @@
# Helldivers 2 Mod Manager CLI # 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. 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 ## Installation
Pre-requisites: Pre-requisites:
- You must have the `unzip` package installed for `zip` archives; - The `unzip` package must be installed for ZIP archives.
- You might want to have the `unarchiver` package installed for `rar` and `7z` 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
bash -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh)" 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 ## 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 ```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) - `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
@@ -34,67 +40,32 @@ h2mm
- `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
- `m` or `modpack` - Manage modpacks (collections of mods) - `modpack` or `m` - Manage modpacks (collections of mods)
- `nexus-setup` or `ns` - Setup Nexus Mods integration - `nexus-setup` or `ns` - Setup Nexus Mods integration
- `update` or `up` - Update h2mm to latest version - `update` or `up` - Update h2mm to latest version
- `reset` or `rs` - Reset all installed mods - `reset` or `rs` - Reset all installed mods
- `help` or `h` - Display this help message - `help` or `h` - Display this help message
### Examples ## Examples
To find out how to use a command, you can run `h2mm <COMMAND> --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
```bash ```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
h2mm list -v # verbose mode h2mm uninstall --index 3
h2mm modpack create "Example modpack"
h2mm modpack switch "Example modpack"
``` ```
#### Uninstall a mod > 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.
>
```bash > 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`.
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
```
## Nexus Mods integration ## 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: 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.
```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.
## Contributing ## Contributing
+335 -206
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 # Helldivers 2 Mod Manager CLI
VERSION="0.6.17" VERSION="0.7.0"
# --- Globals --- # --- 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")" 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" 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() { function h() {
display_help="$1" # helper function to display help for any command
[[ $# -eq 1 || "$2" == "--help" || "$2" == "-h" ]] && { $display_help; exit 0; } 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() { function log() {
local type="$1" local type="$1"
shift shift
case "$type" in case "$type" in
INFO) "INFO")
[[ "$silent" == "true" ]] && return [[ "$silent" == "true" ]] && return
echo -e "$*" >&2 echo -e "$*" >&2
;; ;;
WARNING) "WARNING")
[[ "$silent" == "true" ]] && return [[ "$silent" == "true" ]] && return
echo -e "${ORANGE}[!]${NC} $*" >&2 echo -e "${ORANGE}[!]${NC} $*" >&2
;; ;;
ERROR) "ERROR")
echo -e "${RED}[ERROR]${NC} $*" >&2 echo -e "${RED}[ERROR]${NC} $*" >&2
;; ;;
PROMPT) "PROMPT")
echo -ne "$*" >&2 echo -ne "$*" >&2
;; ;;
*) *)
@@ -367,237 +379,318 @@ function initialize_modpack_directories() {
# --- Help Functions --- # --- Help Functions ---
function display_help_main() { function display_help_main() {
cat << EOF h e "Helldivers 2 Mod Manager CLI v$VERSION"
Helldivers 2 Mod Manager v${VERSION} h n
Usage: h2mm [OPTION] COMMAND h e "Usage:"
Commands: h e " h2mm [OPTIONS] COMMAND [ARGS]"
i, install Install a mod by the file provided (directory, zip, patch) h n
u, uninstall Uninstall a mod h e "Options"
l, list List all installed mods h c "-h, --help" "Show this help message for any command and exit."
e, enable Enable a mod h n
d, disable Disable a mod h e "Commands:"
r, rename Rename a mod h e " # Mod management"
o, order Change load order of a mod h c "i, install" "Install a mod with any combination of mod files, directories, and zip files"
m, modpack Manage modpacks (collections of mods) h c "u, uninstall" "Uninstall a mod"
ex, export Export installed mods to a zip file h c "l, list" "List all installed mods and their status"
im, import Import mods from a zip file h c "e, enable" "Enable a mod"
ns, nexus-setup Setup Nexus Mods integration h c "d, disable" "Disable a mod"
up, update Update h2mm to the latest version h c "r, rename" "Rename a mod"
rs, reset Reset all installed mods h c "o, order" "Change load order of a mod"
help Display this help message h n
For more information on usage, use h2mm COMMAND --help. h e " # Bulk management"
Example: h c "m, modpack" "Manage user-defined modpacks (collections of installed mods)"
h2mm install /path/to/mod.zip h c "rs, reset" "Reset all installed mods"
h2mm uninstall -n "Example mod" h c "ex, export" "Export installed mods to an archive"
h2mm list h c "im, import" "Import mods from an archive"
EOF 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() { function display_help_install() {
cat << EOF h e "Usage:"
Usage: h2mm install [OPTIONS] <MOD_FILES|MOD_DIRECTORIES|MOD_ZIPS> h e " h2mm install [OPTIONS] <FILES...>"
Install a mod with any combination of mod files, directories, and zip files. h n
Options: h e "Description:"
-n "MOD_NAME" Name of the mod. h e " Install one or more mods from files, directories, or archives."
MOD_ZIPS Zip file(s) containing mod files. h e " Supports .zip, .rar, and .7z archives (requires 'unzip' or 'unar')."
MOD_FILES Mod file(s), accepts wildcards. h e " It is recommended to be in the directory where mod archives are, or to use absolute paths."
MOD_DIRECTORIES Directory/directories containing mod files. h e " Use 'cd ~/Downloads' to go to the Downloads folder, and run 'ls -la' to find the archives to install."
Example: h e " Use the Tab key to auto-complete file and folder names, this helps escape spaces and special characters."
h2mm install mod.zip h n
h2mm install /path/to/mod/directory/ h e "Options:"
h2mm install /path/to/mod.zip /path/to/mod2.zip /path/to/mod/files # mix and match however you want h c "-n <NAME>" "Specify a custom mod name (defaults to archive/folder name)"
h2mm install -n "Example mod" mod.patch_0 mod.patch_0.stream # -n to specify name of the mod h n
EOF 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() { function display_help_uninstall() {
cat << EOF h e "Usage:"
Usage: h2mm uninstall [OPTIONS] <"MOD_NAME"|MOD_INDEX> h e " h2mm uninstall [OPTIONS]"
Uninstall a mod by name or index. h n
Options: h e "Description:"
-n "MOD_NAME" Name of the mod to uninstall. h e " Uninstall a previously installed mod by name or index."
-i MOD_INDEX Index of the mod to uninstall. h e " Removes mod files, updates the database, and downgrades mods if necessary."
Example: h n
h2mm uninstall -n "Example mod" h e "Options:"
h2mm uninstall -i 3 h c "-i, --index <INDEX>" "Uninstall mod by index (see 'h2mm list')"
EOF h c "-n, --name <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() { function display_help_enable() {
cat << EOF h e "Usage:"
Usage: h2mm enable [OPTIONS] <"MOD_NAME"|MOD_INDEX> h e " h2mm enable [OPTIONS]"
Enable a mod by name or index. h n
Options: h e "Description:"
-n "MOD_NAME" Name of the mod to enable. h e " Enable a previously installed mod by name or index."
-i MOD_INDEX Index of the mod to enable. h e " This moves mod files from disabled state to active and preserves their order."
Example: h n
h2mm enable -n "Example mod" h e "Options:"
h2mm enable -i 3 h c "-i, --index <INDEX>" "Enable mod by index (see 'h2mm list')"
EOF h c "-n, --name <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() { function display_help_disable() {
cat << EOF h e "Usage:"
Usage: h2mm disable [OPTIONS] <"MOD_NAME"|MOD_INDEX> h e " h2mm disable [OPTIONS]"
Disable a mod by name or index. h n
Options: h e "Description:"
-n "MOD_NAME" Name of the mod to disable. h e " Disable a previously enabled mod by name or index."
-i MOD_INDEX Index of the mod to disable. h e " This renames mod files to mark them as disabled and updates the database."
Example: h n
h2mm disable -n "Example mod" h e "Options:"
h2mm disable -i 3 h c "-i, --index <INDEX>" "Disable mod by index (see 'h2mm list')"
EOF h c "-n, --name <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() { function display_help_list() {
cat << EOF h e "Usage:"
Usage: h2mm list h e " h2mm list [OPTIONS]"
Database of mods is stored in Steam/steamapps/common/Helldivers\ 2/data/mods.csv h n
You can rename, delete, or edit this file to manage mods manually. h e "Description:"
Options: h e " List all installed mods, showing their status, type (LOCAL or NEXUS),"
-v Verbose mode. h e " and optionally more details in verbose mode."
EOF 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() { function display_help_reset() {
cat << EOF h e "Usage:"
Usage: h2mm reset h e " h2mm reset [OPTIONS]"
Reset all installed mods. h n
Deletes all installed mods/modpacks and the database file. h e "Description:"
Database of mods is stored in Steam/steamapps/common/Helldivers 2/data/mods.csv, along with the mods. h e " Reset all installed mods by deleting their files and clearing the database."
EOF 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() { function display_help_export() {
cat << EOF h e "Usage:"
Usage: h2mm export h e " h2mm export [OPTIONS]"
Export installed mods, modpacks and database to a zip file (in h2mm format - archive with csv) in the current working directory. h n
EOF 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() { function display_help_import() {
cat << EOF h e "Usage:"
Usage: h2mm import <ARCHIVE_FILE> h e " h2mm import [OPTIONS] <ARCHIVE_FILE>"
Import mods, modpacks and database from an archive file (coming from h2mm). h n
EOF 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() { function display_help_order() {
cat << EOF h e "Usage:"
Usage: h2mm order [OPTIONS] <"MOD_NAME"|MOD_INDEX> <NEW_INDEX> h e " h2mm order [OPTIONS] <NEW_INDEX>"
Change order of a mod by name or index. h n
Options: h e "Description:"
-i index Index of the mod to order. h e " Change the load order of an installed mod."
-n "MOD_NAME" Name of the mod to order. h e " Mods can be reindexed by name or index to ensure correct load priority."
Example: h n
h2mm order -n "Example mod" 6 h e "Options:"
h2mm order -i 3 6 h c "-i, --index <INDEX>" "Specify the mod by its current index (see 'h2mm list')"
EOF h c "-n, --name <NAME>" "Specify the mod by name"
h n
h e "Arguments:"
h c "<NEW_INDEX>" "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() { function display_help_rename() {
cat << EOF h e "Usage:"
Usage: h2mm rename [OPTIONS] <"MOD_NAME"|MOD_INDEX> <NEW_NAME> h e " h2mm rename [OPTIONS] <NEW_NAME>"
Rename a mod by name or index. h n
Options: h e "Description:"
-n "MOD_NAME" Name of the mod to rename. h e " Rename an installed mod."
-i MOD_INDEX Index of the mod to rename. h n
Example: h e "Options:"
h2mm rename -n "Example mod" "New mod name" h c "-i, --index <INDEX>" "Specify the mod by its current index (see 'h2mm list')"
h2mm rename -i 3 "New mod name" h c "-n, --name <NAME>" "Specify the mod by current name"
EOF h n
h e "Arguments:"
h c "<NEW_NAME>" "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() { function display_help_modpack() {
echo "Usage:" h e "Usage:"
echo " h2mm modpack [COMMAND] [OPTIONS]" h e " h2mm modpack COMMAND [ARGS]"
echo h n
echo "Description:" h e "Description:"
echo " Manage modpacks (collections of installed mods)." h e " Manage user-defined modpacks (collections of installed mods)."
echo h n
echo "Commands:" h e "Commands:"
printf " %-20s %s\n" "create" "Create a modpack from current mods" h c "list, l" "List all installed modpacks"
printf " %-20s %s\n" "list" "List all installed modpacks" h c "create, c" "Create a new modpack from currently installed mods"
printf " %-20s %s\n" "switch" "Switch to a modpack" h c "delete, d" "Delete a modpack"
printf " %-20s %s\n" "delete" "Delete a modpack" h c "overwrite, o" "Overwrite an existing modpack"
printf " %-20s %s\n" "overwrite" "Overwrite an existing modpack" h c "switch, s" "Switch to a different modpack"
printf " %-20s %s\n" "reset" "Reset all installed modpacks" h c "reset, rs" "Reset all installed modpacks"
echo h c "help, h" "Show this help message and exit"
echo "Options:" h n
printf " %-20s %s\n" "-v, --verbose" "Enable verbose output" h e "Examples:"
printf " %-20s %s\n" "-h, --help" "Show help for modpack or a subcommand" h e " h2mm modpack list"
echo h e " h2mm modpack create \"Example modpack\""
echo "Examples:" h e " h2mm modpack switch -n \"Example modpack\""
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 h e "Usage:"
Usage: h2mm modpack-list h e " h2mm modpack list [OPTIONS]"
List all installed modpacks. h n
Database of modpacks is stored in Steam/steamapps/common/Helldivers\ 2/data/modpacks/modpacks.csv h e "Description:"
You can rename, delete, or edit this file to manage modpacks manually. h e " List all saved modpacks."
Options: h e " Database of modpacks is stored in the game directory under data/modpacks/modpack.csv"
-v Verbose mode. h n
EOF h e "Options:"
h c "-v, --verbose" "Show detailed contents of each modpack"
} }
function display_help_modpack_create() { function display_help_modpack_create() {
cat << EOF h e "Usage:"
Usage: h2mm modpack-create -n "MODPACK_NAME" h e " h2mm modpack create -n <MODPACK_NAME>"
Create a modpack from a range of mods specified after command is called. h n
EOF h e "Description:"
h e " Create a new modpack by selecting installed mods."
h n
h e "Options:"
h c "-n <MODPACK_NAME>" "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() { function display_help_modpack_switch() {
cat << EOF h e "Usage:"
Usage: h2mm modpack-switch [OPTIONS] <"MODPACK_NAME"|MODPACK_INDEX> h e " h2mm modpack switch [OPTIONS]"
Switch to a modpack by name or index. h n
Options: h e "Description:"
-n "MODPACK_NAME" Name of the modpack to switch to. h e " Switch to a saved modpack. This will reset the current mods and apply the selected modpack."
-i index Index of the modpack to switch to. h n
EOF h e "Options:"
h c "-i, --index <MODPACK_INDEX>" "Index of the modpack to switch to"
h c "-n, --name <MODPACK_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() { function display_help_modpack_reset() {
cat << EOF h e "Usage:"
Usage: h2mm modpack-reset h e " h2mm modpack reset"
Reset all installed modpacks. h n
Deletes all installed modpacks and the database file. h e "Description:"
Database of modpacks is stored in Steam/steamapps/common/Helldivers\ 2/data/modpacks/modpacks.csv, along with the modpacks. h e " Reset all saved modpacks. This will delete all modpack archives and the modpack database."
EOF
} }
function display_help_modpack_delete() { function display_help_modpack_delete() {
cat << EOF h e "Usage:"
Usage: h2mm modpack-delete [OPTIONS] <"MODPACK_NAME"|MODPACK_INDEX> h e " h2mm modpack delete [OPTIONS]"
Delete a modpack by name or index. h n
Options: h e "Description:"
-n "MODPACK_NAME" Name of the modpack to delete. h e " Delete a saved modpack by name or index. This will remove the modpack archive and its database entry."
-i index Index of the modpack to delete. h n
EOF h e "Options:"
h e " -i, --index <modpack_index> Index of the modpack to delete."
h e " -n, --name <modpack_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() { function display_help_modpack_overwrite() {
cat << EOF h e "Usage:"
Usage: h2mm modpack-overwrite [OPTIONS] <"MODPACK_NAME"|MODPACK_INDEX> h e " h2mm modpack overwrite [OPTIONS]"
Overwrite a modpack (the mods that it uses) by name or index. h n
Options: h e "Description:"
-n "MODPACK_NAME" Name of the modpack to overwrite. h e " Overwrite an existing modpack with the currently installed mods."
-i index Index of the modpack to overwrite. h n
EOF h e "Options:"
h c "-n, --name <MODPACK_NAME>" "Name of the modpack to overwrite"
h c "-i, --index <MODPACK_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() { function display_help_nexus_setup() {
cat << EOF h e "Usage:"
Usage: h2mm nexus-setup h e " h2mm nexus-setup"
Setup nexusmods integration. h n
This will create a config file in ~/.config/h2mm/apikey with the API key. h e "Description:"
This will create a desktop entry in ~/.local/share/applications/h2mm.desktop. h e " Run the setup wizard to configure Nexus Mods integration for h2mm."
Run this again in case you change the API key or want to change the desktop entry. h e " You will need to provide your Nexus Mods API key and configure a terminal for the desktop entry."
EOF 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 --- # --- Main Functions ---
@@ -655,7 +748,7 @@ function downgrade_mods() {
} }
function mod_enable() { function mod_enable() {
parse_help_has_arguments display_help_enable "$@" parse_help display_help_enable ARGS "$@"
local mod_name="" local mod_name=""
local mod_index="" local mod_index=""
@@ -728,7 +821,7 @@ function mod_enable() {
} }
function mod_disable() { function mod_disable() {
parse_help_has_arguments display_help_disable "$@" parse_help display_help_disable ARGS "$@"
local mod_name="" local mod_name=""
local mod_index="" local mod_index=""
@@ -793,7 +886,7 @@ function mod_disable() {
} }
function mod_reset() { 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 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): " 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() { function mod_install() {
parse_help_has_arguments display_help_install "$@" parse_help display_help_install ARGS "$@"
local mod_name="" local mod_name=""
local mod_dir=() local mod_dir=()
local mod_files=() local mod_files=()
@@ -1085,7 +1178,7 @@ function mod_install() {
} }
function mod_uninstall() { function mod_uninstall() {
parse_help_has_arguments display_help_uninstall "$@" parse_help display_help_uninstall ARGS "$@"
local mod_name="" local mod_name=""
local mod_index="" local mod_index=""
@@ -1142,7 +1235,7 @@ function mod_uninstall() {
} }
function mod_list() { function mod_list() {
parse_help_no_arguments display_help_list "$@" parse_help display_help_list "$@"
local verbose=false local verbose=false
# parse arguments # parse arguments
@@ -1190,7 +1283,7 @@ function mod_list() {
} }
function mod_export() { function mod_export() {
parse_help_no_arguments display_help_export "$@" parse_help display_help_export "$@"
local save_dir=${BACKUPS_DIR} local save_dir=${BACKUPS_DIR}
local archive_name="HD2-Mods-$(date +%Y-%m-%d_%H-%M-%S)" local archive_name="HD2-Mods-$(date +%Y-%m-%d_%H-%M-%S)"
local modpack_export=false local modpack_export=false
@@ -1246,7 +1339,7 @@ function mod_export() {
} }
function mod_import() { 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; } local modpack=false; [[ "$1" == "--modpack" ]] && { modpack=true; shift 1; }
# check if the file exists # check if the file exists
@@ -1305,7 +1398,7 @@ function mod_import() {
} }
function mod_order { function mod_order {
parse_help_has_arguments display_help_order "$@" parse_help display_help_order ARGS "$@"
local mod_name="" local mod_name=""
local mod_index="" local mod_index=""
local new_index="" local new_index=""
@@ -1471,7 +1564,7 @@ function mod_order {
} }
function mod_rename() { function mod_rename() {
parse_help_has_arguments display_help_rename "$@" parse_help display_help_rename ARGS "$@"
local mod_name="" local mod_name=""
local new_mod_name="" local new_mod_name=""
local mod_index="" local mod_index=""
@@ -1514,8 +1607,43 @@ function mod_rename() {
# --- Modpack management --- # --- 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() { function modpack_list() {
parse_help_no_arguments display_help_modpack_list "$@" parse_help display_help_modpack_list "$@"
local verbose=false local verbose=false
# parse arguments # parse arguments
@@ -1560,7 +1688,7 @@ function modpack_list() {
} }
function modpack_create() { function modpack_create() {
parse_help_has_arguments display_help_modpack_create "$@" parse_help display_help_modpack_create ARGS "$@"
local modpack_name="" local modpack_name=""
# parse arguments # parse arguments
@@ -1637,7 +1765,7 @@ function modpack_create() {
} }
function modpack_switch() { function modpack_switch() {
parse_help_has_arguments display_help_modpack_switch "$@" parse_help display_help_modpack_switch ARGS "$@"
local modpack_name="" local modpack_name=""
local modpack_index="" local modpack_index=""
@@ -1674,7 +1802,7 @@ function modpack_switch() {
} }
function modpack_reset() { 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): " log PROMPT "Are you sure you want to ${RED}reset${NC} all installed modpacks? (Y/n): "
read confirm read confirm
@@ -1692,7 +1820,7 @@ function modpack_reset() {
} }
function modpack_delete() { function modpack_delete() {
parse_help_has_arguments display_help_modpack_delete "$@" parse_help display_help_modpack_delete ARGS "$@"
local modpack_name="" local modpack_name=""
local modpack_index="" local modpack_index=""
@@ -1727,7 +1855,7 @@ function modpack_delete() {
} }
function modpack_overwrite() { function modpack_overwrite() {
parse_help_has_arguments display_help_modpack_overwrite "$@" parse_help display_help_modpack_overwrite ARGS "$@"
local modpack_name="" local modpack_name=""
local modpack_index="" local modpack_index=""
@@ -1780,6 +1908,7 @@ function self_update() {
exit 0 exit 0
} }
=======
function modpack() { function modpack() {
parse_help_has_arguments display_help_modpack "$@" parse_help_has_arguments display_help_modpack "$@"
local type="$1" local type="$1"
@@ -1818,7 +1947,7 @@ function modpack() {
# --- Nexus Mods Integration --- # --- Nexus Mods Integration ---
function nexus_setup() { function nexus_setup() {
parse_help_no_arguments display_help_nexus_setup "$@" parse_help display_help_nexus_setup "$@"
local nexus_api_key="" local nexus_api_key=""
log INFO "This is the setup wizard for the ${ORANGE}Nexus Mods${NC} integration." log INFO "This is the setup wizard for the ${ORANGE}Nexus Mods${NC} integration."
@@ -2059,7 +2188,7 @@ function check_for_h2mm_update() {
# --- Main --- # --- Main ---
function main() { function main() {
parse_help_has_arguments display_help_main "$@" parse_help display_help_main ARGS "$@"
command="$1"; shift command="$1"; shift
+7
View File
@@ -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 "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 "Check out the ${ORANGE}Nexus Mods integration${NC} by running 'h2mm nexus-setup'."
log INFO "Made with <3 by v4n and contributors." 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!"
+1 -1
View File
@@ -1 +1 @@
0.6.17 0.7.0