You are currently viewing Lightweight scripts-like Kotlin programs?

Lightweight scripts-like Kotlin programs?

Usual Kotlin project is pretty heavyweight and involves separate Mave / Gradle and IDE config. Usually it’s Android or Server Side server with lots of files etc.

I would like to use Kotlin also for small scripts. Like replacement for Python or even BASH.

1) So you just write some

play.kt

file in some folder, and then just run it like

kotlin run play.kt

and it runs it.

2) Sometimes you have a minimal set of dependencies, and say you store it as

/projects/kotlin_std_ext

and you just want to use it in your script (but without involving heavy machinery like Maven / Gradle) an easy way something like

kotlin run play.kt --lib /projects/kotlin_std_ext

So, is that possible? And do people use something like that?

P.S.

I know about kotlin scripts, I tried it but don’t want to use it. I don’t remember exactly why, but there were some issues or limitations, it was not the same as usual kotlin file.

submitted by /u/h234sd
[link] [comments]