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
Commandfor a CliRunner, with its logger, styled help and examples. -
CliRunner<
T> -
A
CommandRunnerwith styled help, a Logger and standard flags. - Logger
-
A logger for command-line tools, shaped like
mason_logger'sLogger. - 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.
Exceptions / Errors
- TasksFailed
-
Thrown by Logger.tasks (and TaskContext.tasks) with
exitOnErrorwhen tasks fail, after the list has drawn its final frame. - UsageException