Kotlin Native for CLIs by Ryan Harter
Recording brought to you by American Express. https://americanexpress.io/kotlin-jobs When making Command Line Interfaces (CLIs) it sure would be nice to use everyone's favorite language, but we also have to think about things like distribution and portability. While we can zip up our jars and assets, ask the user to extract them somewhere, and write a shell script to configure the JVM, classpath, and launch our Jar, there are also other options that allow us to write in Kotlin, while also building tools that look and feel just like any other on a user's system. When I first wrote Differ, a Kotlin Multiplatform library for image comparison, the sample app was a Kotlin JVM app like any other, which exercised the library by letting you provide two images for comparison and printing the results to STDOUT. It soon became apparent that the sample app would also make a useful CLI, but JVM based CLIs involve quite a bit of overhead to distribute and run. Since Differ is a multiplatform library, Kotlin Native was a straightforward solution to make a CLI written in Kotlin which looks and feels just like any other native tool on a developer machine. In this talk we'll discuss situations in which Kotlin Native can be a great tool for building CLIs, some of the downsides of using Kotlin Native over other tools, and some of the tools and libraries that can help. Using real world examples, we'll explore how you can build, package and run CLIs just like other tools installed on your system. After this talk, you'll be prepared to use Kotlin Native to create your own useful, portable, and testable CLIs that work just like any other utility. Talk by: Ryan Harter #KotlinConf