A fast-prototyping command line system

Related tags

Kotlin kotliner-cli
Overview

Kotlin-er CLI

A different take on making command line programs, emphasizing development speed over customization

Status

Auto-deployed to Maven Central after passing unit tests using GitHub Actions

release status snapshot status

Download

dependencies {
  //...
  implementation("com.lightningkite:kotliner-cli:1.0.1-SNAPSHOT")
}

Example

import com.lightningkite.kotlinercli.cli
import java.io.File

fun main(args: Array<String>) = cli(args, ::runServer, ::migrate, ::dump, ::deleteItems)

fun runServer(host: String = "0.0.0.0", port: Int = 8080) = println("Running the server at $host on port $port")
fun migrate(version: Int) = println("Upgrading the database")
fun dump(to: File) = println("Dumping to a file")
fun deleteItems(vararg ids: Int) = println("Deleting ${ids.joinToString()}")
$ myProgram
Available commands:
runServer(host: String = ..., port: Int = ...): Unit
migrate(version: Int): Unit
dump(to: File): Unit
deleteItems(ids: IntArray): Unit

$ myProgram runServer --help
runServer
--host: String (optional)
--port: Int (optional)

$ myProgram runServer
Running the server at 0.0.0.0 with port 8000

$ myProgram runServer 127.0.0.0 8080
Running the server at 127.0.0.0 with port 8080

$ myProgram runServer --port 8080
Running the server at 0.0.0.0 with port 8080

$ myProgram deleteItems 1 2 3
Deleting 1, 2, 3

Supported Features

  • Primitive Types
  • Types with a constructor that takes a String
  • Ordered Arguments
  • Named Arguments
  • Default Arguments
  • Variadic Arguments
  • Boolean Flags (i.e. using --flag for flag=true)
  • Description Annotation - add the annotation to provide more documentation about functions and parameters.

Potential Features

  • Annotation to automatically register functions to expose to the CLI
    • Questionable security-wise - makes it easy to insert functionality with no obvious connection.
  • Compiler plugin to read KDoc for runtime documentation

Deliberately unsupported features

  • Object types without a string constructor - No good way to represent in the command line.
  • Expose all functions in the command line - would be a potential security problem
You might also like...
Koin Annotations - help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you

The goal of Koin Annotations project is to help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you. The goal is to help developer experience to scale and go fast πŸš€ , thanks to Kotlin Compilers.

Clickstream - A Modern, Fast, and Lightweight Android Library Ingestion Platform.
Clickstream - A Modern, Fast, and Lightweight Android Library Ingestion Platform.

Clickstream is an event agnostic, real-time data ingestion platform. Clickstream allows apps to maintain a long-running connection to send data in real-time.

Simple, fast, efficient logging facade for Android apps

Β΅log Simple, fast, and efficient logging facade for Android apps. Inspired by Timber and Logcat. Features Lazy message evaluation Pluggable backends (

πŸ”“ Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.
πŸ”“ Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

EasyPermissions-ktx Kotlin version of the popular googlesample/easypermissions wrapper library to simplify basic system permissions logic on Android M

Celebrate more with this lightweight confetti particle system 🎊
Celebrate more with this lightweight confetti particle system 🎊

Konfetti 🎊 πŸ₯³ Celebrate more with this lightweight confetti particle system. Create realistic confetti by implementing this easy to use library. Demo

Spigot-Plugin message providing system written in Kotlin

teller Spigot-Plugin message providing system written in Kotlin Usage Create an instance of PropertiesMessageProvider using the Constructor with an in

Reapp is everything you need to build amazing apps with React: a collection of packages that work together, our UI kit, and a CLI that scaffolds your app and includes a server and build system.
Reapp is everything you need to build amazing apps with React: a collection of packages that work together, our UI kit, and a CLI that scaffolds your app and includes a server and build system.

What is it? Reapp is everything you need to build amazing apps with React: a collection of packages that work together, our UI kit, and a CLI that sca

🚧 General-Purpose Module System for Kotlin.

🚧 Modules: General-Purpose Module System A module system & loader for Kotlin. Made for me to use. Architecture Module is a building block for this sy

AndroRAT is a tool designed to give the control of the android system remotely and retrieve informations from it.
AndroRAT is a tool designed to give the control of the android system remotely and retrieve informations from it.

AndroRAT is a tool designed to give the control of the android system remotely and retrieve informations from it. Androrat is a client/server application developed in Java Android for the client side and the Server is in Python.

Releases(1.0.3)
Owner
Lightning Kite
Lightning Kite
Run Minecraft on the command line

HeadlessForge While headless Minecraft Clients aren't anything new, they come with a drawback. The Minecraft API is missing and you need to add all fu

null 28 Oct 17, 2022
A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

Varabyte 349 Jan 9, 2023
Utility - The cross-platform native Kotlin command line tool template

Utility The cross-platform native Kotlin command line tool template. Usage Make

null 0 Jan 3, 2022
kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin.

kinstall kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin. use First, install kinstall its

david kilmer 0 Apr 24, 2022
A fast, lightweight, entity component system library written in Kotlin.

Fleks A fast, lightweight, entity component system library written in Kotlin. Motivation When developing my hobby games using LibGDX, I always used As

Simon 66 Dec 28, 2022
Simple cron command runner for Bukkit 1.17+

Cron Runner Description / μ„€λͺ… Simple cron command runner for Bukkit 1.17+ Bukkit 1.17 이상을 μœ„ν•œ κ°„λ‹¨ν•œ cron λͺ…λ Ήμ–΄ μ‹€ν–‰κΈ° μž…λ‹ˆλ‹€. Configuration Guide (config.yml) deb

Patrick 3 Sep 24, 2021
Clay is an Android library project that provides image trimming which is originally an UI component of LINE Creators Studio

Clay Clay is an Android library project that provides image trimming. Fully written in Kotlin, Clay is originally a UI component of LINE Creators Stud

LINE 119 Dec 27, 2022
[Android Library] Get easy access to device information super fast, real quick

DeviceInfo-Sample Simple, single class wrapper to get device information from an android device. This library provides an easy way to access all the d

Anitaa Murthy 193 Nov 20, 2022
Fast Seek for ExoPlayer

FastExoPlayerSeeker Introduction Adds fast seeking for exoplayer. (Note: it also depends on the amount of video encoding, mainly IDR Frames) How to in

Jan Rabe 40 Dec 27, 2022
Feature flags solution that is fast, lean, and open-source.

FFS Feature flags solution that is fast, lean, and open-source. Documentation Full documentation available at https://doist.github.io/ffs/. Project FF

Doist 84 Oct 31, 2022