https://kotlinlang.org logo
#scripting
Title
# scripting
p

Paul Woitaschek

03/20/2020, 8:36 AM
How can I pass an argument to kts file? When I run
kotlin my-script.main.kts --hello
the compiler doesn't pass it through:
error: invalid argument: --hello
v

vqrs

03/20/2020, 8:44 AM
Just a guess, but try
kotlin my-script.main.kts -- --hello
instead, the double dash on its own is often used to separate program args from forwarded args
p

Paul Woitaschek

03/20/2020, 9:49 AM
Thanks, that worked!
3 Views