fix: small fixes

This commit is contained in:
v4n
2025-01-14 16:50:34 +02:00
parent 33403a69f1
commit c0192065c0
3 changed files with 49 additions and 28 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
h2path *
*.patch* !h2mm
*test* !install.sh
!README.md
+25 -5
View File
@@ -3,6 +3,7 @@
# TODO: # TODO:
# export mods # export mods
# import mods # import mods
# reset all
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[0;32m' GREEN='\033[0;32m'
@@ -49,8 +50,7 @@ function find_game_directory() {
fi fi
echo "$game_dir" > "$H2PATH" echo "$game_dir" > "$H2PATH"
echo -e "Game directory ${GREEN}saved{$NC} to: $H2PATH" >&2 echo -e "Game directory ${GREEN}saved${NC}: $game_dir" >&2
echo "--- /// ---" >&2
echo "$game_dir" echo "$game_dir"
} }
@@ -63,7 +63,7 @@ function initialize_directories() {
echo "Database file created at: $DB_FILE" echo "Database file created at: $DB_FILE"
fi fi
echo "--- /// MODS /// ---" >&2 echo "--- /// MAIN /// ---" >&2
} }
function display_help() { function display_help() {
@@ -71,15 +71,19 @@ function display_help() {
echo "Usage: h2mm [command] [options]" echo "Usage: h2mm [command] [options]"
echo "Commands:" echo "Commands:"
echo " install -n \"<mod_name>\" <mod_files> Install a mod with a name and files." echo " install -n \"<mod_name>\" <mod_files> Install a mod with a name and files."
echo " list List all installed mods."
echo " uninstall -n \"<mod_name>\" Uninstall a mod by name." echo " uninstall -n \"<mod_name>\" Uninstall a mod by name."
echo " list List all installed mods."
echo " export \"<zip_name>\" Export installed mods to a zip file (not yet implemented)." echo " export \"<zip_name>\" Export installed mods to a zip file (not yet implemented)."
echo " import \"<zip_name>\" Import mods from a zip file (not yet implemented)." echo " import \"<zip_name>\" 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 " help Display this help message."
echo "For more information, use h2mm [command] --help, available for install and uninstall." echo "For more information on usage, use h2mm [command] --help, available for install and uninstall."
echo "Basic Usage:" echo "Basic Usage:"
echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream" echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream"
echo " h2mm uninstall -n \"Example mod\"" 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() { function display_install_help() {
@@ -111,6 +115,11 @@ function install_mod() {
local mod_files=() local mod_files=()
local mod_dir="" local mod_dir=""
if [[ $# -eq 0 ]]; then
display_install_help
exit 0
fi
# parse arguments # parse arguments
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
@@ -205,6 +214,11 @@ function uninstall_mod() {
local mod_name="" local mod_name=""
local mod_index="" local mod_index=""
if [[ $# -eq 0 ]]; then
display_uninstall_help
exit 0
fi
# parse arguments # parse arguments
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
@@ -310,6 +324,12 @@ case "$command" in
uninstall_mod "$@" uninstall_mod "$@"
echo "--- /// END /// ---" 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 display_help
;; ;;
+1 -1
View File
@@ -18,4 +18,4 @@ if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then
exit 1 exit 1
fi 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'."