cli library

Tools for command-line apps: a mason_logger-shaped Logger with dart_tui prompts, plain mode and colour detection, and CliRunner, a package:args command runner with styled help and standard flags.

import 'package:dart_tui/cli.dart';

final logger = Logger();
final name = await logger.prompt('Project name?', defaultValue: 'app');
final progress = logger.progress('Creating $name');
// ...
progress.complete();

See the migration guide for the differences from mason_logger, and the guide "Build a CLI with commands" for CliRunner.

Classes

CliCommand<T>
A Command for a CliRunner, with its logger, styled help and examples.
CliRunner<T>
A CommandRunner with styled help, a Logger and standard flags.
Logger
A logger for command-line tools, shaped like mason_logger's Logger.
Progress
A spinner line from Logger.progress.
ProgressOptions
How a Progress looks.
Task
One step for Logger.tasks.
TaskContext
What a running Task can do with its line.

Enums

Level
How much a Logger writes. Each level includes the ones after it.

Exceptions / Errors

TasksFailed
Thrown by Logger.tasks (and TaskContext.tasks) with exitOnError when tasks fail, after the list has drawn its final frame.
UsageException