cli library

Versatile and performant CLI builder

Classes

Argument cli
A plain word the user types without a dash, like c in run to c.
CLI cli
The whole program: the top command plus a version and a start method.
ColourPrompt cli
Pick a colour from a grid of hues and shades.
Command cli
One thing your program can do, like add in todo add.
ConfirmPrompt cli
A yes or no question, picked with the arrows or the y and n keys.
DatePrompt cli
Pick a day on a month calendar.
FilePrompt cli
Browse folders and pick a file (or folder).
Flag cli
An on/off switch, like --verbose or -v.
Fuzzy cli
Fuzzy matching, like a code editor's file finder.
GridPrompt<T> cli
Pick one option from a grid, moving in all four directions.
HelpPrinter cli
Builds the coloured help screen for a command.
Input cli
Everything the user typed, ready to read inside a command's run.
KeyPress cli
One key press: what it was, plus any Ctrl, Alt or Shift held with it.
KeyReader cli
Reads key presses one at a time from a Terminal.
ListCursor cli
The highlighted row of a list, plus the slice of rows that fits on screen.
ListPrompt<T, R> cli
The shared part of list prompts: options, a cursor and a scrolling window.
LiveRegion cli
A block of lines at the bottom of the output that can be redrawn in place.
MultilinePrompt cli
A text box for several lines, like a commit message.
MultiSelectPrompt<T> cli
Tick any number of options from a list.
Option cli
A named setting that takes a value, like --name Sam or -n Sam.
Parser cli
Reads the user's arguments one word at a time.
ParseResult cli
What Parser found in the user's arguments.
PathPrompt cli
Type a path, with Tab completing file and folder names.
Pickers cli
Visual pickers for values: sliders, ranges, ratings, dates, files and colours.
PromptLine cli
Asks one question on one line until the answer passes a check.
PromptRunner cli
Runs a PromptView: shows it, feeds it keys and gives back its answer.
Prompts cli
Questions for the user: text, passwords, numbers, yes/no and lists.
PromptView<T> cli
The base of every interactive prompt.
RangePrompt cli
Pick a range on a track with two handles, like a price filter.
RatingPrompt cli
Pick a score out of max stars.
SearchPrompt<T> cli
Pick one option by typing to filter the list, like a command palette.
SelectPrompt<T> cli
Pick one option from a list.
SliderPrompt cli
Pick a whole number on a track, like a volume.
Spinner cli
An animated spinner with a label, for work of unknown length.
StdTerminal cli
The real console: stdin and stdout.
TagsPrompt cli
Type a list of short words, like labels or package names.
Task cli
One piece of work in a task list.
TaskContext cli
What a running task can tell the screen about itself.
TaskReport cli
How a task went.
Tasks cli
Several tasks running side by side, each with a live status line.
Terminal cli
The keyboard and screen that prompts and widgets talk to.
TextBuffer cli
Editable text with a cursor, for text boxes.
TextPrompt<T> cli
A one-line text box: free text, passwords and numbers.
TogglePrompt cli
A list of on/off switches, like settings.
TreeNode cli
One line of a Widgets.tree: a label and the lines under it.
Widgets cli
Text widgets for the terminal: boxes, tables, trees and lists.

Enums

Key cli
The kinds of key a prompt can react to.
KeyResult cli
What a prompt wants to happen after a key press.
PathKind cli
What a file picker gives back: files, folders, or either.
PromptMode cli
How prompts get their answers.
Tone cli
The kinds of message a Widgets.callout can show.

Typedefs

CursorSpot = ({int column, int line})
Where to put the blinking cursor in a frame: a line and a column.
FuzzyMatch = ({List<int> positions, int score})
How well a search matched some text, and which characters matched.
IntRange = ({int end, int start})
A picked range of whole numbers, both ends included.
KeyHint = (String, String)
A key and what it does, shown in the dim key hints under a prompt.
PromptCheck<T> = ({String? problem, T? value}) Function(String typed)
What a prompt's check makes of the typed text.
RunCommand = FutureOr<void> Function(Input input) cli
The function a command calls when the user picks it.
TaskWork = Future<void> Function(TaskContext task)
Work for Tasks.run: gets a TaskContext to report on itself.
TextParser<T> = ({String? problem, T? value}) Function(String text)
Turns typed text into an answer, or a problem to show.

Exceptions / Errors

CLIError cli
A mistake the user made when typing the command.
PromptCancelled cli
Thrown when a prompt ends without an answer.