Projects
View on GitHub
kotlin-inquirer/kotlin-inquirer
About
A collection of common interactive command line user interfaces written in Kotlin
Web & App DevelopmentMeasured star growth
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- -1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalA collection of common interactive command line user interfaces written in
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
Explore related projects
Loading…