Interactive prompts made easy!

Related tags

Utility interakt
Overview

interakt

Interactive prompts made easy!

Install

Gradle - Kotlin DSL

repositories {
    mavenCentral()
}

dependencies {
    implementation("xyz.davidsimon:interakt:0.1.0")
}

Maven

<dependency>
    <groupId>xyz.davidsimongroupId>
    <artifactId>interaktartifactId>
    <version>0.1.0version>
dependency>

Usage

asciicast

To construct and run an interactive prompt, you need to:

  1. Obtain a Prompt instance
  2. Add PromptFields to the prompt
  3. Execute the prompt

Using a few convenience methods, we can achieve all this in just a few lines of code:

prompt {
    text("foo:", default = "default value")
    integer("bar:", default = 42)
    list("baz:", listOf("1", "2", "3"), true)

    println("Result:")
    for((key, value) in execute()) {
        println("${key.promptMessage} $value")
    }
}

Fields

PromptField

Base class for all other fields

Options:

Parameter Type Description
promptMessage String Message to display before user input
shouldPrompt (PromptResult, PromptField ) -> Boolean Controls whether the field should be prompted. Receives the answers entered so far and the current field's instance
default (PromptResult, PromptField ) -> T? Provides a default value that will be pre-filled

TextField

Prompts user for simple text input

IntegerField

Prompts user for integer input

ListField

Prompts the user to choose from a list of items. The displayed name and the actual value of the items may differ.

Options:

Parameter Type Description
choices (PromptResult) -> List > Returns the available choices

TextListField

Prompts the user to choose from a list of text items. Optionally the user may enter a custom value.

Options:

Parameter Type Description
choices (tr: PromptResult) -> List > Returns the available choices
allowCustom Boolean Allow the user to enter a custom value. If true an additional choice will be added with an empty string value
customPromptMessage String Message to display when user enter custom value

Acknowledgement

interakt is built using JLine

You might also like...
AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.

AnyChart for Android AnyChart Android Charts is an amazing data visualization library for easily creating interactive charts in Android apps. It runs

An interactive indicator to navigate between the different pages of a ViewPager
An interactive indicator to navigate between the different pages of a ViewPager

Android PagerSlidingTabStrip Interactive paging indicator widget, compatible with the ViewPager from the Android Support Library. Try out the sample a

An interactive indicator to navigate between the different pages of a ViewPager
An interactive indicator to navigate between the different pages of a ViewPager

Android PagerSlidingTabStrip (default Material Design) This library is not maintained anymore and there will be no further releases. For most of the c

Android library to control Transition animates. A simple way to create a interactive animation.
Android library to control Transition animates. A simple way to create a interactive animation.

TransitionPlayer Android library to control Transition animates. A simple way to create a interactive animation. Demo1 SimpleTransition Code: ....

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.

#Scripting Layer for Android (SL4A) SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreter

Android library to control Transition animates. A simple way to create a interactive animation.
Android library to control Transition animates. A simple way to create a interactive animation.

TransitionPlayer Android library to control Transition animates. A simple way to create a interactive animation. Demo1 SimpleTransition Code: ....

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.

An interactive command line interface to a transactional key value store
An interactive command line interface to a transactional key value store

Transactional Key-Value Store An interactive command line interface to a transactional key value store. Commands: SET key value // store the value

High-quality Interactive Audio/Video Android SDK

High-quality Interactive Audio/Video Android SDK

A news app made using android studio in Java with features like favourite news, Location detector for local news, and especially made with HUAWEI APIs

HuaweiGlobalNewsApp A news app made using android studio in Java with features like favourite news, Location detector for local news, and especially m

Attendance Management app made in Kotlin for students. Made during ASJ, Google Developer Students Club, AITR Indore
Attendance Management app made in Kotlin for students. Made during ASJ, Google Developer Students Club, AITR Indore

Android-Study-Jams Attendance Management Problem Statement: Based on the observation, there is no available student attendance system in many educatio

YourStore app made in Kotlin for Local e-commerce. made during ASJ, Developer Students Club, BIT Mesra
YourStore app made in Kotlin for Local e-commerce. made during ASJ, Developer Students Club, BIT Mesra

Android-Study-Jams YourStore , Vocal for Local Problem Statement: Over past two years, local businesses have faced lot of troubles due to Covid-19 and

:package: Android Parcelables made easy through code generation.

Parceler Have a question? Ask it on StackOverflow. Found an issue? Please report it. In Android, Parcelables are a great way to serialize Java Objects

Android Parcelable models made easy

AutoParcel AutoParcel is an AutoValue extension that enables Parcelable values generation. Just add implements Parcelable to your @AutoValue annotated

Android Kotlin paged endpoints made easy
Android Kotlin paged endpoints made easy

A smart and simple way to work with paged endpoints. To see an example of how to use it, check out the introducing Fountain posts: part one and part t

Easy social network authorization for Android. Supports Facebook, Twitter, Instagram, Google+, Vkontakte. Made by Stfalcon

SocialAuthHelper A library that helps to implement social network authorization (Facebook, Twitter, Instagram, GooglePlus, Vkontakte). Who we are Need

GraphQL for Java with Spring Boot made easy.

GraphQL for Java with Spring Boot made easy.

An android library for easy implementation of Toasts in Android with easy customisation.
An android library for easy implementation of Toasts in Android with easy customisation.

ToastTypeDecore ©️ A library for easy implementation of Toasts in Android with easy customisation. Latest Version : v2.1 Screenshots Success Toast1 Su

Releases(0.3.0)
  • 0.3.0(Nov 1, 2021)

  • 0.2.0(Oct 29, 2021)

    • Refactor shouldPrompt and default fields to take current value of the given field instead of the field object itself
    • Handle multiple choices in ListField, and add SingleValueListField with the original functionality of ListField
    • Add StatefulField interface which can be used in complex rendering functions (like ListField)
    • Update demo with a multi-choice list example
    • Update demo gif
    • Update README
    • Bump version to 0.2.0
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Oct 27, 2021)

Owner
David Simon
CS student at Budapest Institute of Technology and Economics
David Simon
[] Easy async loading for Android's ListView/GridView

NOTE: Smoothie's API is not final yet. Although the library is fairly funcional, this is still beta-quality code. Do not rely on it for production cod

Lucas Rocha 988 Dec 22, 2022
Very easy to use wrapper library for Android SharePreferences

Treasure English document Treasure是一个Android平台上基于SharePreferences的偏好存储库,只需要定义接口,无需编写实现,默认支持Serializable和Parcelable。运行时0反射,不仅使用方便而且性能和原生写法几乎无差别。 使用方法 1

星一 507 Nov 12, 2022
Access and process various types of personal data in Android with a set of easy, uniform, and privacy-friendly APIs.

PrivacyStreams PrivacyStreams is an Android library for easy and privacy-friendly personal data access and processing. It offers a functional programm

null 269 Dec 1, 2022
Easy SharedPreference Engine foR ANDROid

esperandro Easy SharedPreference Engine foR ANDROid What? esperandro makes it simple to use SharedPreferences in a nicer and less error-prone way. Wit

David Kunzler 184 Nov 25, 2022
It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.

Shutter-Android It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android. What is Shutter? Shutter is an Androi

Levi Bostian 56 Oct 3, 2022
A simple and easy to use stopwatch and timer library for android

TimeIt Now with Timer support! A simple and easy to use stopwatch and timer library for android Introduction A stopwatch can be a very important widge

Yashovardhan Dhanania 35 Dec 10, 2022
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021
An easy-to-use, cross-platform measurement tool that pulls data out of CD pipelines and analysis the four key metrics for you.

Maintained by SEA team, ThoughtWorks Inc. Read this in other languages: English, 简体中文 Table of Contents About the Project Usage How to Compute Contrib

Thoughtworks 277 Jan 7, 2023
Compose easy forms validation library

Compose EasyForms Focus on building your form UI while the library do the heavy work for you. Features Built in support for most of the Form widgets i

Kosh Sergani 24 Jul 18, 2022
This is a easy way to publish MQTT message and receive MQTT message

SMQ-CLIENT This is a easy way to publish MQTT message and receive MQTT message This is provider a spring stater for quick use Recive message form the

SUDA 1 Apr 25, 2022