Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - kotlin-inquirer/kotlin-inquirer: A collection of common interactive command line user interfaces written in Kotlin

A collection of common interactive command line user interfaces written in Kotlin - kotlin-inquirer/kotlin-inquirer

Visit SiteGitHub - kotlin-inquirer/kotlin-inquirer: A collection of common interactive command line user interfaces written in Kotlin

GitHub - kotlin-inquirer/kotlin-inquirer: A collection of common interactive command line user interfaces written in Kotlin

A collection of common interactive command line user interfaces written in Kotlin - kotlin-inquirer/kotlin-inquirer

Powered by 0x5a.live 💗

example workflow Apache License V.2 codecov Awesome Kotlin Badge

A collection of common interactive command line user interfaces written in Pure Kotlin inspired by Inquirer.js

:rocket: Run Demo Using kscript

Remote scriplet raw-URL

kscript https://bit.ly/kotlin-inquirer-pizza

Or clone it

git clone https://github.com/kotlin-inquirer/kotlin-inquirer.git
cd kotlin-inquirer
kscript ./scripts/pizza.kts

Or without kscript

./gradlew shadowJar
java -jar example/build/libs/kotlin-pizza.jar

:cloud: Download

Gradle

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  implementation 'com.github.kotlin-inquirer:kotlin-inquirer:0.1.0'
}

:clipboard: Usages

Confirm

val isDelivery: Boolean = KInquirer.promptConfirm(message = "Is this for delivery?", default = false)
println("Is Delivery: $isDelivery")

Input

val comments: String = KInquirer.promptInput(message = "Any comments on your purchase experience?")
println("Comments: $comments")

Input Numbers

val quantity: BigDecimal = KInquirer.promptInputNumber(message = "How many do you need?")
println("Quantity: $quantity")

Input Password

val password: String = KInquirer.promptInputPassword(message = "Enter Your Password:", hint = "password")
println("Password: $password")

Input Password custom mask

val passwordMasked: String = KInquirer.promptInputPassword(
    message = "Enter Your Password:",
    hint = "password",
    mask = "🤫"
)
println("Password: $passwordMasked")

List

val size: String = KInquirer.promptList(message = "What size do you need?", choices = listOf("Large", "Medium", "Small"))
println("Size: $size")

List with more options

val continent: String = KInquirer.promptList(
    message = "Select a continent:",
    choices = listOf(
        "Asia",
        "Africa",
        "Europe",
        "North America",
        "South America",
        "Australia",
        "Antarctica",
    ),
    hint = "press Enter to pick",
    pageSize = 3,
    viewOptions = ListViewOptions(
        questionMarkPrefix = "🌍",
        cursor = " 😎 ",
        nonCursor = "    ",
    )
)
println("Continent: $continent")

Checkbox

val toppings: List<String> = KInquirer.promptCheckbox(
    message = "What about the toppings?",
    choices = listOf(
        "Pepperoni and cheese",
        "All dressed",
        "Hawaiian",
    ),
)
println("Toppings: $toppings")

Checkbox with more options

val colors: List<String> = KInquirer.promptCheckbox(
    message = "Which colors do you prefer?",
    choices = listOf(
        "Red",
        "Green",
        "Blue",
        "Yellow",
        "Black",
        "White",
    ),
    hint = "pick a color using spacebar",
    maxNumOfSelection = 3,
    minNumOfSelection = 2,
    pageSize = 3,
    viewOptions = CheckboxViewOptions(
        questionMarkPrefix = "❓",
        cursor = " 👉 ",
        nonCursor = "    ",
        checked = "✅ ",
        unchecked = "○ ",
    )
)
println("Colors: $colors")

:crystal_ball: Roadmap

Components

  • Confirm
  • Input
  • Input Numbers
  • Input Password
  • List
  • Checkbox
  • Input validation error message
  • Support Hint
  • Better package name
  • Add examples for ViewOption
  • Support List/Checkbox Fuzzy search
  • Support List/Checkbox autocomplete
  • Add DSL support
  • Consider non static function for prompts

Operation

  • Examples
  • Logo
  • GIFs
  • codecov
  • Maven Central

Kotlin Resources

are all listed below.

Resources

listed to get explored on!!

Made with ❤️

to provide different kinds of informations and resources.