util/output/output library

Command output facility that builds declarative UIs using widgets and supports different output formats (text, json, yaml).

Classes

BoxTextWidget
Renders a boxed message via CommandLogger.box.
CommandHintTextWidget
Renders a "command hint" message.
CommandOutput
Facade for the output of a command.
ConfirmationWidget
Renders a yes/no confirmation prompt.
ErrorOutputWidget
ErrorWidget
ExceptionHandlingWidget<E extends Exception>
Renders an error widget if the context contains a matching exception. Otherwise it renders the elseWidget if provided.
FormatBranchingWidget
FormattedStreamStringWidget<R extends Object>
Writes one formatted document per stream element as it arrives.
FormattedStreamTableWidget<R extends Object>
Streams a text table: headers first, then one row as each element arrives.
FormattedStringWidget<O extends Object>
Renders a string formatted with the given formatter.
FormattedTableWidget<R extends Object>
User-friendly text table widget.
InfoTextWidget
Renders an "info text" message.
InitTextWidget
InteractiveWidget<T>
Base class for interactive widgets.
JsonErrorOutputWidget
JsonErrorWidget
JsonOutputFormatter<O extends Object>
LineTextWidget
Renders a raw line via CommandLogger.line.
ListTextWidget
Renders a bullet list via CommandLogger.list.
NilWidget
Renders nothing.
OutputContext
Context for building OutputWidget UIs. Carries data when building the widget tree.
OutputFormatter<O extends Object, D extends Object>
Base class for output formatters - given an input "object" type O returns a formatted "data" type D.
OutputWidget
Base class for all command output widgets.
OutputWidgetList
Renders its children in order.
ProgressStreamWidget<T extends Object>
Shows a heading-only spinner while consuming a Stream.
RawStringWidget
Renders a raw string.
StringColumnListWidget
SuccessTextWidget
Renders a success message.
TableColumnFormatter<R extends Object>
Formatting of a column, its heading and its cell value formatter.
TextErrorOutputWidget
TextErrorWidget
TextTableData
TextTableOutputFormatter<R extends Object>
Formats a list of row objects into a TextTableData object, needed for FormattedTableWidget.
TextTableWidget
Text table rendering widget.
WarningTextWidget
Renders a warning message.
WidgetNode
YamlErrorOutputWidget
YamlErrorWidget
YamlOutputFormatter<O extends Object>

Enums

OutputFormat
The supported output formats.

Functions

mapValueFormatter<O extends Map<String, Object?>>({required String key}) ValueFormatter<O>
Returns a ValueFormatter function that gets the value for the given key of a Map<String, Object?> and applies standard formatting on it, depending on its datatype.
objValueFormatter<O extends Object>({required ValueGetter<O> getter}) ValueFormatter<O>
Returns a ValueFormatter function that gets the desired value for an object and applies standard formatting on it, depending on its datatype.

Typedefs

Operation<O> = Future<O> Function()
An "operation" function, for the business logic operations of commands that produce some data that is rendered by the command output.
QualifiedException = ({Exception exception, StackTrace stackTrace})
ValueFormatter<O extends Object> = String Function(O object, {required bool? utc})
A function that returns a formatted String value for a given object or for an attribute of that object.
ValueGetter<O extends Object> = Object? Function(O object)
A function that returns the desired value for a given object or for an attribute of that object.