easy_tui 1.0.0 easy_tui: ^1.0.0 copied to clipboard
Very simple tool to generate menus for gathering user input.
EasyTUI #
About #
This is a small library for generating text-driven menus in the terminal.
In this library, TUI stands for Text User Interface
Usage #
Importing Into Project #
Add to a dart project as a dependency with
dependency:
easy_tui: ^1.0.0
Then, in a file, add import 'package:easy_tui/$PACKAGE_HERE';
where $PACKAGE_HERE
is the name of the class you want to import.
Documentation #
- See
CLInvoice
for an example of its use. Otherwise, see below for a brief guide. - Dartdoc has been used extensively to provide an idea of how to use it, if you wish to peruse the source code.
cli/io/in/TerminalInput.dart
- A wrapper around
dart:io/stdin
that checks automatically for certain conditions, and determines whether or not the program should exit depending on their value.
cli/io/out/TerminalOut.dart
- A utility that wraps around
print()
to provide convenience for functionality like clearing the screen, pausing execution until enter is pressed, etc.
tui/Layouts.dart
- An enum that describes whether the menu will be displayed vertically or horizontally.
tui/MenuModifiers.dart
- An enum that modifies properties of a created UI class
tui/TextDialogue.dart
- A static class that is responsible for handling simple menus.
- Currently, its only responsibility is yes/no questions.
tui/TextFormUI.dart
- A class that can be used to gather input from the user for multiple answers to multiple prompts.
- The answers return as
String
s, and can be any answer at all.- Data validation is up to the programmer.
tui/TextOptionUI.dart
- A class that can be used to gather a single input from the user.
- Inputs are restricted to a specific set of approved answers.
- Inputs are returned as
int
s corresponding to the index of the approved answer.- Data validation is handled by the class.
- Inputs are returned as
tui/TextUI.dart
- Abstract superclass to the
Text
*UI
classes. You won't be interacting with it unless you're trying to access its constants.
Examples #
See the examples/
folder.