Package-level declarations

Types

Link copied to clipboard
class ConfirmationPrompt<T : Any>(firstPrompt: Prompt<T>, secondPrompt: Prompt<T>, valueMismatchMessage: String = "Values do not match, try again")

A prompt that requires the user to enter the same value twice.

Link copied to clipboard
sealed class ConversionResult<out T>
Link copied to clipboard
interface CursorMovements
Link copied to clipboard
data class PrintRequest(val text: String, val trailingLinebreak: Boolean, val stderr: Boolean)
Link copied to clipboard
abstract class Prompt<T>(prompt: String, val terminal: Terminal, default: T? = null, showDefault: Boolean = true, showChoices: Boolean = true, hideInput: Boolean = false, choices: Collection<T> = emptyList(), promptSuffix: String = ": ", invalidChoiceMessage: String = "Invalid value, choose from ")

The base class for prompts.

Link copied to clipboard

A base class for terminal interfaces that prints using standard kotlin.io functions.

Link copied to clipboard
class StringPrompt(prompt: String, terminal: Terminal, default: String? = null, showDefault: Boolean = false, showChoices: Boolean = true, hideInput: Boolean = false, choices: List<String> = emptyList(), promptSuffix: String = ": ", invalidChoiceMessage: String = "Invalid value, choose from ", allowBlank: Boolean = true) : Prompt<String>

A Prompt that returns the user input unchanged.

Link copied to clipboard
class Terminal

Functions for printing styled text to the terminal.

Link copied to clipboard
interface TerminalCursor
Link copied to clipboard

Detect information about the current terminal.

Link copied to clipboard
data class TerminalInfo(var ansiLevel: AnsiLevel, var ansiHyperLinks: Boolean, val outputInteractive: Boolean, val inputInteractive: Boolean, val supportsAnsiCursor: Boolean)

Information about the current terminal

Link copied to clipboard
Link copied to clipboard

A provider for a TerminalInterface.

Link copied to clipboard

A TerminalInterface that records all output and allows you to provide input.

Link copied to clipboard
Link copied to clipboard
class YesNoPrompt(prompt: String, terminal: Terminal, default: Boolean? = null, uppercaseDefault: Boolean = true, showChoices: Boolean = true, choiceStrings: List<String> = listOf("y", "n"), promptSuffix: String = ": ", invalidChoiceMessage: String = "Invalid value, choose from ") : Prompt<Boolean>

A boolean prompt that asks for a yes or no response.

Functions

Link copied to clipboard
fun Terminal.danger(message: Any?, whitespace: Whitespace = Whitespace.PRE, align: TextAlign = TextAlign.NONE, overflowWrap: OverflowWrap = OverflowWrap.NORMAL, width: Int? = null, stderr: Boolean = false)

Print a line styled with the theme's Theme.danger style.

Link copied to clipboard
fun Terminal.info(message: Any?, whitespace: Whitespace = Whitespace.PRE, align: TextAlign = TextAlign.NONE, overflowWrap: OverflowWrap = OverflowWrap.NORMAL, width: Int? = null, stderr: Boolean = false)

Print a line styled with the theme's Theme.info style.

Link copied to clipboard
fun Terminal.muted(message: Any?, whitespace: Whitespace = Whitespace.PRE, align: TextAlign = TextAlign.NONE, overflowWrap: OverflowWrap = OverflowWrap.NORMAL, width: Int? = null, stderr: Boolean = false)

Print a line styled with the theme's Theme.muted style.

Link copied to clipboard
fun TerminalRecorder.outputAsHtml(includeBodyTag: Boolean = true, includeCodeTag: Boolean = true, backgroundColor: Color? = SRGB("#0c0c0c")): String

Render the contents of this TerminalRecorder as an HTML document.

Link copied to clipboard
fun Terminal.prompt(prompt: String, default: String? = null, showDefault: Boolean = true, showChoices: Boolean = true, hideInput: Boolean = false, choices: Collection<String> = emptyList(), promptSuffix: String = ": ", invalidChoiceMessage: String = "Invalid value, choose from "): String?

Print a prompt to the user and return the value they enter.

inline fun <T> Terminal.prompt(prompt: String, default: T? = null, showDefault: Boolean = true, showChoices: Boolean = true, hideInput: Boolean = false, choices: Collection<T> = emptyList(), promptSuffix: String = ": ", invalidChoiceMessage: String = "Invalid value, choose from ", crossinline convert: (String) -> ConversionResult<T>): T?
Link copied to clipboard
fun Terminal.success(message: Any?, whitespace: Whitespace = Whitespace.PRE, align: TextAlign = TextAlign.NONE, overflowWrap: OverflowWrap = OverflowWrap.NORMAL, width: Int? = null, stderr: Boolean = false)

Print a line styled with the theme's Theme.success style.

Link copied to clipboard
fun Terminal.warning(message: Any?, whitespace: Whitespace = Whitespace.PRE, align: TextAlign = TextAlign.NONE, overflowWrap: OverflowWrap = OverflowWrap.NORMAL, width: Int? = null, stderr: Boolean = false)

Print a line styled with the theme's Theme.warning style.