@@ -32,7 +32,7 @@ goto :usage
32
32
echo usage: %~n0 ^ < command^ > [options]
33
33
echo .
34
34
echo Available commands:
35
- echo demo ^ < type^ > Run a demo (gogo, repl, password)
35
+ echo demo ^ < type^ > Run a demo ^ (gogo, repl, password^ )
36
36
echo example ^ < className^ > Run an example from org.jline.demo.examples
37
37
echo rebuild Clean and install the project
38
38
echo license-check Check license headers
@@ -65,16 +65,16 @@ if "%demo_type%"=="" (
65
65
echo jansi Add Jansi support
66
66
echo jna Add JNA support
67
67
echo verbose Enable verbose logging
68
- echo ffm Enable Foreign Function Memory (preview)
68
+ echo ffm Enable Foreign Function Memory ^ (preview^ )
69
69
echo .
70
70
echo Gogo-specific options:
71
71
echo ssh Add SSH support
72
72
echo telnet Add Telnet support
73
- echo remote Add remote support (SSH and Telnet)
73
+ echo remote Add remote support ^ (SSH and Telnet^ )
74
74
echo .
75
75
echo Password-specific options:
76
- echo --mask=X Use X as the mask character (default: *)
77
- echo Use --mask= (empty) for no masking
76
+ echo --mask=X Use X as the mask character ^ (default: *^ )
77
+ echo Use --mask= ^ (empty^ ) for no masking
78
78
exit /b 1
79
79
)
80
80
@@ -152,27 +152,27 @@ if "%~1"=="--help" (
152
152
echo --help Show this help message
153
153
echo ssh Add SSH support
154
154
echo telnet Add Telnet support
155
- echo remote Add remote support (SSH and Telnet)
155
+ echo remote Add remote support ^ (SSH and Telnet^ )
156
156
echo debug Enable remote debugging
157
157
echo debugs Enable remote debugging with suspend
158
158
echo jansi Add Jansi support
159
159
echo jna Add JNA support
160
160
echo verbose Enable verbose logging
161
- echo ffm Enable Foreign Function Memory (preview)
161
+ echo ffm Enable Foreign Function Memory ^ (preview^ )
162
162
echo .
163
163
echo To test with a dumb terminal, use: set TERM=dumb ^ & %~n0 demo gogo
164
164
) else if " %demo_type% " == " password" (
165
165
echo Usage: %~n0 demo password [options]
166
166
echo Options:
167
167
echo --help Show this help message
168
- echo --mask=X Use X as the mask character (default: *)
169
- echo Use --mask= (empty) for no masking
168
+ echo --mask=X Use X as the mask character ^ (default: *^ )
169
+ echo Use --mask= ^ (empty^ ) for no masking
170
170
echo debug Enable remote debugging
171
171
echo debugs Enable remote debugging with suspend
172
172
echo jansi Add Jansi support
173
173
echo jna Add JNA support
174
174
echo verbose Enable verbose logging
175
- echo ffm Enable Foreign Function Memory (preview)
175
+ echo ffm Enable Foreign Function Memory ^ (preview^ )
176
176
echo .
177
177
echo To test with a dumb terminal, use: set TERM=dumb ^ & %~n0 demo password
178
178
) else if " %demo_type% " == " consoleui" (
@@ -181,10 +181,10 @@ if "%~1"=="--help" (
181
181
echo --help Show this help message
182
182
echo debug Enable remote debugging
183
183
echo debugs Enable remote debugging with suspend
184
- echo jansi Add Jansi support (recommended for Windows)
185
- echo jna Add JNA support (alternative for Windows)
184
+ echo jansi Add Jansi support ^ (recommended for Windows^ )
185
+ echo jna Add JNA support ^ (alternative for Windows^ )
186
186
echo verbose Enable verbose logging
187
- echo ffm Enable Foreign Function Memory (preview)
187
+ echo ffm Enable Foreign Function Memory ^ (preview^ )
188
188
echo .
189
189
echo Note: On Windows, either Jansi or JNA library must be included in classpath.
190
190
echo To test with a dumb terminal, use: set TERM=dumb ^ & %~n0 demo consoleui
@@ -197,7 +197,7 @@ if "%~1"=="--help" (
197
197
echo jansi Add Jansi support
198
198
echo jna Add JNA support
199
199
echo verbose Enable verbose logging
200
- echo ffm Enable Foreign Function Memory (preview)
200
+ echo ffm Enable Foreign Function Memory ^ (preview^ )
201
201
echo .
202
202
echo To test with a dumb terminal, use: set TERM=dumb ^ & %~n0 demo %demo_type%
203
203
)
@@ -290,12 +290,15 @@ if "%~1"=="--help" (
290
290
)
291
291
)
292
292
)
293
- ) else if " %~1 :~0,7%" == " --mask=" (
294
- :: Already processed for password demo
295
- rem Do nothing
296
293
) else (
297
- :: Unknown option, assume it's a JVM option
298
- set " JVM_OPTS = !JVM_OPTS! %~1 "
294
+ set " arg = %~1 "
295
+ if " !arg:~0 ,7 ! " == " --mask=" (
296
+ :: Already processed for password demo
297
+ rem Do nothing
298
+ ) else (
299
+ :: Unknown option, assume it's a JVM option
300
+ set " JVM_OPTS = !JVM_OPTS! %~1 "
301
+ )
299
302
)
300
303
301
304
shift
@@ -313,14 +316,16 @@ set "java_version=%java_version:~0,2%"
313
316
set " java_version = %java_version:~0 ,2 % "
314
317
if " %java_version:~1 ,1 % " == " ." set " java_version = %java_version:~0 ,1 % "
315
318
316
- :: Add --enable-native-access if JDK 16+
317
- if %java_version% GEQ 16 (
318
- :: Only add if not already present
319
- echo %JVM_OPTS% | findstr /C:" --enable-native-access=ALL-UNNAMED" > nul
320
- if errorlevel 1 (
321
- set " JVM_OPTS = %JVM_OPTS% --enable-native-access=ALL-UNNAMED"
322
- )
323
- )
319
+ :: Check Java version for --enable-native-access
320
+ for /f " tokens=3" %%v in ('java -version 2^ > ^ &1 ^ | findstr /i " version" ') do set " java_version = %%v "
321
+ set " java_version = %java_version:" =% "
322
+ set " java_version = %java_version:~0 ,2 % "
323
+ if " %java_version:~1 ,1 % " == " ." set " java_version = %java_version:~0 ,1 % "
324
+ :: Default to JDK 8 behavior if version not detected
325
+ if not defined java_version set " java_version = 8"
326
+ :: Add --enable-native-access only for Java 16+
327
+ echo %java_version% | findstr /C:" 16" /C:" 17" /C:" 18" /C:" 19" /C:" 20" /C:" 21" /C:" 22" > nul
328
+ if not errorlevel 1 set " JVM_OPTS = %JVM_OPTS% --enable-native-access=ALL-UNNAMED"
324
329
325
330
:: Launch the demo
326
331
echo Launching %MAIN_CLASS% ...
@@ -404,7 +409,20 @@ java -cp "%cp%" %JVM_OPTS% org.jline.demo.examples.%example_name%
404
409
goto :eof
405
410
406
411
:rebuild
407
- call mvnw.cmd clean install %*
412
+ :: Check if the first argument is "rebuild" and remove it if so
413
+ set " mvn_args = "
414
+ :parse_rebuild_args
415
+ if " %~1 " == " " goto :do_rebuild
416
+ if " %~1 " == " rebuild" (
417
+ shift
418
+ goto :parse_rebuild_args
419
+ )
420
+ set " mvn_args = %mvn_args% %~1 "
421
+ shift
422
+ goto :parse_rebuild_args
423
+
424
+ :do_rebuild
425
+ call mvnw.cmd clean install%mvn_args%
408
426
goto :eof
409
427
410
428
:license_check
0 commit comments