From 7d7f580bfc0fbb48fdb0584dd7b750029b0d0bb2 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Wed, 12 Jun 2019 10:51:25 +0000 Subject: [PATCH] add -RFPalts option (#745) --- updater.bat | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/updater.bat b/updater.bat index 3e43db4..16a30e8 100644 --- a/updater.bat +++ b/updater.bat @@ -23,6 +23,7 @@ IF /I "%~1"=="-merge" (SET _merge=1) IF /I "%~1"=="-updatebatch" (SET _updateb=1) IF /I "%~1"=="-singlebackup" (SET _singlebackup=1) IF /I "%~1"=="-esr" (SET _esr=1) +IF /I "%~1"=="-rfpalts" (SET _rfpalts=1) SHIFT GOTO parse :endparse @@ -136,6 +137,10 @@ IF EXIST user.js.new ( CALL :message "Activating ESR section..." CALL :esr user.js.new ) + IF DEFINED _rfpalts ( + CALL :message "Activating RFP Alternatives section..." + CALL :rfpalts user.js.new + ) IF DEFINED _multi ( FORFILES /P user.js-overrides /M *.js >nul 2>&1 IF NOT ERRORLEVEL 1 ( @@ -212,18 +217,37 @@ GOTO :EOF REM ############ ESR Function ############ :esr -SETLOCAL DisableDelayedExpansion +SETLOCAL DisableDelayedExpansion ( FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" "%~1"') DO ( SET "_temp=%%H" SETLOCAL EnableDelayedExpansion IF NOT "!_temp:~-37!"==".x still uses all the following prefs" ( ENDLOCAL & ECHO:%%H - ) ELSE ( - ECHO://!_temp:~2! + ) ELSE ( + ECHO://!_temp:~2! ENDLOCAL ) - ) + ) +)>updatertempfile +MOVE /Y updatertempfile "%~1" >nul +ENDLOCAL +GOTO :EOF + +REM ############ RFP Alts Function ############ +:rfpalts +SETLOCAL DisableDelayedExpansion +( + FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" "%~1"') DO ( + SET "_temp=%%H" + SETLOCAL EnableDelayedExpansion + IF "!_temp:[SETUP-non-RFP]=!"=="!_temp!" ( + ENDLOCAL & ECHO:%%H + ) ELSE ( + ECHO://!_temp:~2! + ENDLOCAL + ) + ) )>updatertempfile MOVE /Y updatertempfile "%~1" >nul ENDLOCAL @@ -270,7 +294,7 @@ GOTO :EOF REM ############### Help ################## :showhelp -MODE 80,50 +MODE 80,53 CLS CALL :message "Available arguments (case-insensitive):" CALL :message " -esr" @@ -298,7 +322,9 @@ ECHO: Run without user input. CALL :message " -singleBackup" ECHO: Use a single backup file and overwrite it on new updates, instead of ECHO: cumulative backups. This was the default behaviour before v4.3. -CALL :message " -updatebatch" +CALL :message " -rfpAlts" +ECHO: Activate RFP Alternatives section +CALL :message " -updateBatch" ECHO: Update the script itself on execution, before the normal routine. CALL :message "" PAUSE