What do folks use for an arg parser for kts script...
# scripting
k
What do folks use for an arg parser for kts scripts? Hitting this with Kotlin 1.4: https://github.com/holgerbrandl/kscript/issues/279 kscript doesn't seem to work w/ annotations so that rules out a bunch of them. Apache Commons CLI seems to work.
m
Could you maybe use
*.main.kts
files instead of kscript?
v
Would that provide argument parsing?
m
Not really but the way to handle the classpath will be different and will maybe not show the problem?
Kscript is really handy so I'd rather fix the scripting environment rather than use something else
For the record, I tried the reproducer project in that issue and it seems to work on my machine 🤷‍♂️ . I don't really want to install docker though so I can't test in the exact same conditions
j
Clikt, but I don't use kscript and use kts
d
There's also a
kotlinx-cli
.
k
Kotlinx-cli uses the same "by" technique that appears to cause that issue with Clikt. Scripts work fine with kotlin 1.3.72. Not a huge deal... Just liked Clikt a lot better than apache commons cli 🙂
h