From c0192065c049434356f028f1160b94436ccb986f Mon Sep 17 00:00:00 2001 From: v4n <105587619+v4n00@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:50:34 +0200 Subject: [PATCH] fix: small fixes --- .gitignore | 7 +++--- h2mm | 68 +++++++++++++++++++++++++++++++++++------------------- install.sh | 2 +- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index c7150a6..3c28b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -h2path -*.patch* -*test* \ No newline at end of file +* +!h2mm +!install.sh +!README.md \ No newline at end of file diff --git a/h2mm b/h2mm index 3992452..042973c 100755 --- a/h2mm +++ b/h2mm @@ -3,6 +3,7 @@ # TODO: # export mods # import mods +# reset all RED='\033[0;31m' GREEN='\033[0;32m' @@ -49,8 +50,7 @@ function find_game_directory() { fi echo "$game_dir" > "$H2PATH" - echo -e "Game directory ${GREEN}saved{$NC} to: $H2PATH" >&2 - echo "--- /// ---" >&2 + echo -e "Game directory ${GREEN}saved${NC}: $game_dir" >&2 echo "$game_dir" } @@ -63,47 +63,51 @@ function initialize_directories() { echo "Database file created at: $DB_FILE" fi - echo "--- /// MODS /// ---" >&2 + echo "--- /// MAIN /// ---" >&2 } function display_help() { echo "Helldivers 2 Mod Manager" echo "Usage: h2mm [command] [options]" echo "Commands:" - echo " install -n \"\" Install a mod with a name and files." - echo " list List all installed mods." - echo " uninstall -n \"\" Uninstall a mod by name." - echo " export \"\" Export installed mods to a zip file (not yet implemented)." - echo " import \"\" Import mods from a zip file (not yet implemented)." - echo " help Display this help message." - echo "For more information, use h2mm [command] --help, available for install and uninstall." + echo " install -n \"\" Install a mod with a name and files." + echo " uninstall -n \"\" Uninstall a mod by name." + echo " list List all installed mods." + echo " export \"\" Export installed mods to a zip file (not yet implemented)." + echo " import \"\" Import mods from a zip file (not yet implemented)." + echo " reset Reset all installed mods (not yet implemented)." + echo " help Display this help message." + echo "For more information on usage, use h2mm [command] --help, available for install and uninstall." echo "Basic Usage:" - echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream" - echo " h2mm uninstall -n \"Example mod\"" + echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream" + echo " h2mm uninstall -n \"Example mod\"" + echo "Advanced Usage:" + echo " Database of mods is stored in Steam/steamapps/common/Helldivers\ 2/data/mods.csv" + echo " You can rename, delete, or edit this file to manage mods manually." } function display_install_help() { echo "Usage: h2mm install -n \"\" [options] " echo "Options:" - echo " -n \"\" Name of the mod (MANDATORY), inside double quotes." - echo " -d Directory containing mod files." - echo " -z Zip file containing mod files (.zip only)." - echo " List of mod files to install." + echo " -n \"\" Name of the mod (MANDATORY), inside double quotes." + echo " -d Directory containing mod files." + echo " -z Zip file containing mod files (.zip only)." + echo " List of mod files to install." echo "Usage:" - echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream" - echo " h2mm install -n \"Example mod\" a5f* (using a wildcard to include all files)" - echo " h2mm install -n \"Example mod\" -d /path/to/mod/files" - echo " h2mm install -n \"Example mod\" -z /path/to/mod.zip" + echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream" + echo " h2mm install -n \"Example mod\" a5f* (using a wildcard to include all files)" + echo " h2mm install -n \"Example mod\" -d /path/to/mod/files" + echo " h2mm install -n \"Example mod\" -z /path/to/mod.zip" } function display_uninstall_help() { echo "Usage: h2mm uninstall [options]" echo "Options:" - echo " -n \"\" Name of the mod to uninstall." - echo " -i Index of the mod to uninstall." + echo " -n \"\" Name of the mod to uninstall." + echo " -i Index of the mod to uninstall." echo "Usage:" - echo " h2mm uninstall -n \"Example mod\"" - echo " h2mm uninstall -i 1" + echo " h2mm uninstall -n \"Example mod\"" + echo " h2mm uninstall -i 1" } function install_mod() { @@ -111,6 +115,11 @@ function install_mod() { local mod_files=() local mod_dir="" + if [[ $# -eq 0 ]]; then + display_install_help + exit 0 + fi + # parse arguments while [[ $# -gt 0 ]]; do case "$1" in @@ -205,6 +214,11 @@ function uninstall_mod() { local mod_name="" local mod_index="" + if [[ $# -eq 0 ]]; then + display_uninstall_help + exit 0 + fi + # parse arguments while [[ $# -gt 0 ]]; do case "$1" in @@ -310,6 +324,12 @@ case "$command" in uninstall_mod "$@" echo "--- /// END /// ---" ;; + export) + echo "Exporting mods to a zip file is not yet implemented." + ;; + import) + echo "Importing mods from a zip file is not yet implemented." + ;; *) display_help ;; diff --git a/install.sh b/install.sh index 4d4b2c4..136f55d 100755 --- a/install.sh +++ b/install.sh @@ -18,4 +18,4 @@ if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then exit 1 fi -echo "Helldivers 2 Mod Manager CLI installed successfully to $DESTINATION_PATH/$SCRIPT_NAME." +echo "Helldivers 2 Mod Manager CLI installed successfully to $DESTINATION_PATH/$SCRIPT_NAME. Use it by running '$SCRIPT_NAME'."