@@ -25,34 +25,22 @@ IF EXIST "%input_cache_path%%publisher_jar%" (
2525 ) ELSE (
2626 SET " jar_location = not_found"
2727 SET " default_choice = 1"
28- SET " default_reason = publisher not found"
2928 ECHO publisher.jar not found in input-cache or parent folder
3029 )
3130)
3231
3332
3433:: Handle command-line argument to bypass the menu
35- :: Known first arguments select a menu option; anything else is passed through to the publisher
36- SET " extraArgs = "
37- IF " %~1 " == " " GOTO showMenu
38- IF /I " %~1 " == " update" SET " userChoice = 1" & GOTO parseExtra
39- IF /I " %~1 " == " build" SET " userChoice = 2" & GOTO parseExtra
40- IF /I " %~1 " == " nosushi" SET " userChoice = 3" & GOTO parseExtra
41- IF /I " %~1 " == " notx" SET " userChoice = 4" & GOTO parseExtra
42- IF /I " %~1 " == " jekyll" SET " userChoice = 5" & GOTO parseExtra
43- IF /I " %~1 " == " clean" SET " userChoice = 6" & GOTO parseExtra
44- IF /I " %~1 " == " exit" SET " userChoice = 0" & GOTO parseExtra
45- :: Unknown first arg - default to build, pass all args through
46- SET " userChoice = 2"
47- GOTO collectArgs
48- :parseExtra
49- SHIFT
50- :collectArgs
51- IF " %~1 " == " " GOTO executeChoice
52- SET " extraArgs = !extraArgs! %1 "
53- SHIFT
54- GOTO collectArgs
55- :showMenu
34+ IF NOT " %~1 " == " " (
35+ IF /I " %~1 " == " update" SET " userChoice = 1"
36+ IF /I " %~1 " == " build" SET " userChoice = 2"
37+ IF /I " %~1 " == " nosushi" SET " userChoice = 3"
38+ IF /I " %~1 " == " notx" SET " userChoice = 4"
39+ IF /I " %~1 " == " jekyll" SET " userChoice = 5"
40+ IF /I " %~1 " == " clean" SET " userChoice = 6"
41+ IF /I " %~1 " == " exit" SET " userChoice = 0"
42+ GOTO executeChoice
43+ )
5644
5745echo ---------------------------------------------------------------
5846ECHO Checking internet connection...
@@ -65,14 +53,10 @@ IF "%online_status%"=="true" (
6553 SET " latest_version = !latest_version: =! "
6654 SET " latest_version = !latest_version:~0 ,-1 ! "
6755) ELSE (
68- ECHO .
69- ECHO *** WARNING: Working offline - this is not the normal mode.
70- ECHO Some features (e.g. terminology rendering) will not work.
71- ECHO .
56+ ECHO We're offline or tx.fhir.org is not available, can only run the publisher without TX...
7257 SET " txoption = -tx n/a"
7358 SET " latest_version = unknown"
7459 SET " default_choice = 4"
75- SET " default_reason = working offline"
7660)
7761
7862echo ---------------------------------------------------------------
@@ -95,11 +79,9 @@ IF NOT "%online_status%"=="true" (
9579 IF NOT " !publisher_version! " == " !latest_version! " (
9680 ECHO An update is recommended.
9781 SET " default_choice = 1"
98- SET " default_reason = newer version available"
9982 ) ELSE (
10083 ECHO Publisher is up to date.
10184 SET " default_choice = 2"
102- SET " default_reason = publisher is up to date"
10385 )
10486)
10587
@@ -114,9 +96,12 @@ echo 4. Build IG - force no TX server
11496echo 5. Jekyll build
11597echo 6. Clean up temp directories
11698echo 0. Exit
99+ :: echo [Press Enter for default (%default_choice%) or type an option number:]
117100echo .
118101
119- choice /C 12345670 /N /CS /D %default_choice% /T 5 /M " Choose an option number or wait 5 seconds for default (%default_choice% - %default_reason% ):"
102+ :: Using CHOICE to handle input with timeout
103+ :: ECHO [Enter=Continue, 1-7=Option, 0=Exit]
104+ choice /C 12345670 /N /CS /D %default_choice% /T 5 /M " Choose an option number or wait 5 seconds for default (%default_choice% ):"
120105SET " userChoice = %ERRORLEVEL% "
121106
122107
@@ -130,12 +115,15 @@ IF "%userChoice%"=="4" GOTO publish_notx
130115IF " %userChoice% " == " 5" GOTO debugjekyll
131116IF " %userChoice% " == " 6" GOTO clean
132117IF " %userChoice% " == " 0" EXIT /B
133- GOTO endscript
118+
119+ :end
120+
121+
134122
135123:debugjekyll
136124 echo Running Jekyll build...
137125 jekyll build -s temp/pages -d output
138- GOTO endscript
126+ GOTO end
139127
140128
141129:clean
@@ -164,7 +152,10 @@ GOTO endscript
164152 echo Removed: .\template
165153 )
166154
167- GOTO endscript
155+ GOTO end
156+
157+
158+
168159
169160
170161:downloadpublisher
@@ -207,7 +198,7 @@ IF DEFINED FORCE (
207198 GOTO download
208199)
209200
210- IF " %skipPrompts% " == " true " (
201+ IF " %skipPrompts% " == " y " (
211202 SET create = Y
212203) ELSE (
213204 SET /p create = " Download? (Y/N) "
@@ -220,7 +211,7 @@ IF /I "%create%"=="Y" (
220211GOTO done
221212
222213:upgrade
223- IF " %skipPrompts% " == " true " (
214+ IF " %skipPrompts% " == " y " (
224215 SET overwrite = Y
225216) ELSE (
226217 SET /p overwrite = " Overwrite %jarlocation% ? (Y/N) "
@@ -274,15 +265,15 @@ GOTO done
274265
275266ECHO .
276267ECHO Updating scripts
277- IF " %skipPrompts% " == " true " (
268+ IF " %skipPrompts% " == " y " (
278269 SET updateScripts = Y
279270) ELSE (
280271 SET /p updateScripts = " Update scripts? (Y/N) "
281272)
282273IF /I " %updateScripts% " == " Y" (
283274 GOTO scripts
284275)
285- GOTO endscript
276+ GOTO end
286277
287278
288279:scripts
@@ -308,28 +299,27 @@ ECHO Updating _build.bat
308299call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\" %build_bat_url% \" ,\" _build.new.bat\" ) } else { Invoke-WebRequest -Uri " %build_bat_url% " -Outfile " _build.new.bat" }
309300if %ERRORLEVEL% == 0 goto upd_script_2
310301echo " Errors encountered during download: %errorlevel% "
311- goto endscript
302+ goto end
312303:upd_script_2
313304start copy /y " _build.new.bat" " _build.bat" ^ &^ & del " _build.new.bat" ^ &^ & exit
314305
315306
316- GOTO endscript
307+ GOTO end
317308
318309
319310:publish_once
320311
321312SET JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
322313
323314:: Debugging statements before running publisher
324- ECHO jar_location is: %jar_location%
315+ ECHO 1jar_location is: %jar_location%
325316IF NOT " %jar_location% " == " not_found" (
326- ECHO IG Publisher FOUND, Publishing...
327- java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% %extraArgs%
317+ java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% %*
328318) ELSE (
329319 ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
330320)
331321
332- GOTO endscript
322+ GOTO end
333323
334324
335325
@@ -338,14 +328,14 @@ GOTO endscript
338328SET JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
339329
340330:: Debugging statements before running publisher
341- ECHO jar_location is: %jar_location%
331+ ECHO 3jar_location is: %jar_location%
342332IF NOT " %jar_location% " == " not_found" (
343- java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% -no-sushi %extraArgs%
333+ java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% -no-sushi %*
344334) ELSE (
345335 ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
346336)
347337
348- GOTO endscript
338+ GOTO end
349339
350340
351341:publish_notx
@@ -354,33 +344,43 @@ SET txoption=-tx n/a
354344SET JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
355345
356346:: Debugging statements before running publisher
357- ECHO jar_location is: %jar_location%
347+ ECHO 2jar_location is: %jar_location%
358348IF NOT " %jar_location% " == " not_found" (
359- java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% %extraArgs%
349+ java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% %*
360350) ELSE (
361351 ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
362352)
363353
364- GOTO endscript
354+ GOTO end
355+
356+
365357
366358
367359:publish_continuous
368360
369361SET JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
370362
371- ECHO jar_location is: %jar_location%
372- IF NOT " %jar_location% " == " not_found" (
373- java %JAVA_OPTS% -jar " %jar_location% " -ig . %txoption% -watch %extraArgs%
363+ :: Debugging statements before running publisher
364+ ECHO Checking %input_cache_path% for publisher.jar
365+ IF EXIST " %input_cache_path% \%publisher_jar% " (
366+ java %JAVA_OPTS% -jar " %input_cache_path% \%publisher_jar% " -ig . %txoption% -watch %*
374367) ELSE (
375- ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
368+ ECHO Checking %upper_path% for publisher.jar
369+ IF EXIST " ..\%publisher_jar% " (
370+ java %JAVA_OPTS% -jar " ..\%publisher_jar% " -ig . %txoption% -watch %*
371+ ) ELSE (
372+ ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
373+ )
376374)
377375
378- GOTO endscript
376+ GOTO end
379377
380378
381- :endscript
379+ :end
382380
383381:: Pausing at the end
382+
383+
384384IF NOT " %skipPrompts% " == " true" (
385385 PAUSE
386386)
0 commit comments