I have a windows batch
@echo off
setlocal
call kotlinc-jvm -cp "%~dp0\lib\commons-cli-1.3.1.jar" -script "%~dp0\RmMvnRepo.kts" %*
endlocal
If I pass "-h" option to the batch, kotlinc-jvm own's help will display. But I want my RmMvnRepo.kts
to receive the option. How to do that?
EDIT: No need to answer this question anymore. I've found a bug in kotlinc related to this.
Think of your code wrapped in main function. Then you can access arguments through args
array.
Call the script with arguments
kotlinc -script ...kts "option1" "option2"
Access the arguments through args variable
println(args.size) // will output 2
Update: Try quotes to pass -h parameter
kotlinc -script ...kts "%*"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With