Commit bed39a0

HPCesia <me@hpcesia.com>
2026-02-24 09:40:22
Remove verbose arg, add yes arg
1 parent 603111b
Changed files (2)
addmods.bat
@@ -1,7 +1,7 @@
 @echo off
 setlocal EnableDelayedExpansion
 
-set "VERBOSE=0"
+set "YES_MODE=0"
 set "PLATFORM_ARG="
 
 :PARSE_ARGS
@@ -10,13 +10,13 @@ if "%~1" == "" goto CHECK_PLATFORM
 if /i "%~1" == "-h" goto ShowHelp
 if /i "%~1" == "--help" goto ShowHelp
 
-if /i "%~1" == "-v" (
-    set "VERBOSE=1"
+if /i "%~1" == "-y" (
+    set "YES_MODE=1"
     shift
     goto PARSE_ARGS
 )
-if /i "%~1" == "--verbose" (
-    set "VERBOSE=1"
+if /i "%~1" == "--yes" (
+    set "YES_MODE=1"
     shift
     goto PARSE_ARGS
 )
@@ -68,6 +68,11 @@ if %ERRORLEVEL% neq 0 (
     exit /b 1
 )
 
+set "PACKWIZ_ARGS="
+if "%YES_MODE%" == "1" (
+    set "PACKWIZ_ARGS=-y"
+)
+
 echo Reading clipboard for: %PLATFORM_NAME% (%PLATFORM_ARG%)...
 if "%VERBOSE%" == "1" (
     echo Verbose mode: ON
@@ -79,32 +84,18 @@ for /f "usebackq tokens=* delims=" %%L in (`powershell -NoProfile -Command "Get-
     if defined line (
         if not "!line:~0,1!" == "#" (
             <nul set /p "=Processing: !line! ... "
-
-            if "!VERBOSE!" == "1" (
-                echo(
-                packwiz %PLATFORM_ARG% add "!line!"
-                if !errorlevel! equ 0 (
-                    echo -^> OK
-                ) else (
-                    echo -^> FAILED
-                )
-                echo ----------------------------------------
+            echo(
+            packwiz %PLATFORM_ARG% add !PACKWIZ_ARGS! "!line!"
+            if !errorlevel! equ 0 (
+                echo -^> OK
             ) else (
-                packwiz %PLATFORM_ARG% add "!line!" >nul
-                if !errorlevel! equ 0 (
-                    echo OK
-                ) else (
-                    echo FAILED
-                    echo   [!] Error occurred while adding above link (use -v for details). >&2
-                )
+                echo -^> FAILED
             )
+            echo ----------------------------------------
         )
     )
 )
 
-if "%VERBOSE%" == "0" (
-    echo ----------------------------------------
-)
 echo Done.
 exit /b 0
 
@@ -119,10 +110,6 @@ echo   platform      The platform to add mods from.
 echo                 Must be either 'mr' (Modrinth) or 'cf' (CurseForge).
 echo(
 echo Options:
-echo   -v, --verbose Show detailed output from packwiz command.
+echo   -y, --yes     Automatically answer yes to all prompts.
 echo   -h, --help    Show this help message and exit.
-echo(
-echo Examples:
-echo   %~nx0 mr -v   # Add mods to Modrinth with detailed logs
-echo   %~nx0 cf      # Add mods to CurseForge silently
 goto :eof
addmods.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERBOSE=0
+YES_MODE=0
 PLATFORM_ARG=""
 
 show_help() {
@@ -15,12 +15,8 @@ show_help() {
   echo "                Must be either 'mr' (Modrinth) or 'cf' (CurseForge)."
   echo ""
   echo "Options:"
-  echo "  -v, --verbose Show detailed output from packwiz command."
+  echo "  -y, --yes     Automatically answer yes to all prompts."
   echo "  -h, --help    Show this help message and exit."
-  echo ""
-  echo "Examples:"
-  echo "  $(basename "$0") mr -v   # Add mods to Modrinth with detailed logs"
-  echo "  $(basename "$0") cf      # Add mods to CurseForge silently"
 }
 
 get_clipboard() {
@@ -53,8 +49,8 @@ while [ $# -gt 0 ]; do
     show_help
     exit 0
     ;;
-  -v | --verbose)
-    VERBOSE=1
+  -y | --yes)
+    YES_MODE=1
     shift
     ;;
   mr | cf)
@@ -95,10 +91,12 @@ if ! command -v packwiz >/dev/null 2>&1; then
   exit 1
 fi
 
-echo "Reading clipboard for: $PLATFORM_NAME ($PLATFORM_CMD)..."
-if [ "$VERBOSE" -eq 1 ]; then
-  echo "Verbose mode: ON"
+PACKWIZ_ARGS=""
+if [ "$YES_MODE" -eq 1 ]; then
+  PACKWIZ_ARGS="-y"
 fi
+
+echo "Reading clipboard for: $PLATFORM_NAME ($PLATFORM_CMD)..."
 echo "----------------------------------------"
 
 get_clipboard | sed '/^[[:space:]]*$/d' | while IFS= read -r line; do
@@ -106,25 +104,13 @@ get_clipboard | sed '/^[[:space:]]*$/d' | while IFS= read -r line; do
 
   printf "Processing: %s ... " "$line"
 
-  if [ "$VERBOSE" -eq 1 ]; then
-    echo ""
-    if packwiz "$PLATFORM_CMD" add "$line"; then
-      echo "-> OK"
-    else
-      echo "-> FAILED"
-    fi
-    echo "----------------------------------------"
+  echo ""
+  if packwiz "$PLATFORM_CMD" add $PACKWIZ_ARGS "$line" </dev/tty; then
+    echo "-> OK"
   else
-    if packwiz "$PLATFORM_CMD" add "$line" >/dev/null; then
-      echo "OK"
-    else
-      echo "FAILED"
-      echo "  [!] Error occurred while adding above link (use -v for details)." >&2
-    fi
+    echo "-> FAILED"
   fi
+  echo "----------------------------------------"
 done
 
-if [ "$VERBOSE" -eq 0 ]; then
-  echo "----------------------------------------"
-fi
 echo "Done."