util/output/output library

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

Classes

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
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.
InteractiveWidget<T>
Base class for interactive widgets.
JsonErrorOutputWidget
JsonErrorWidget
JsonOutputFormatter<O extends Object>
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.
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.
WidgetNode
YamlErrorOutputWidget
YamlErrorWidget
YamlOutputFormatter<O extends Object>

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.