UsageOutputHandler class

The settings and behavior for the usage output - controls the help output and the usage exception output.

Constructors

UsageOutputHandler({OutputSinks sinks = const OutputSinks(), UsageSettings usageSettings = const UsageSettings(), UsageExceptionSettings exceptionSettings = const UsageExceptionSettings(), Iterable<UsageExceptionHandler>? addExceptionHandlers})
The provided exception handlers are added before the standard exception handlers.
UsageOutputHandler.replace({OutputSinks sinks = const OutputSinks(), UsageSettings usageSettings = const UsageSettings(), UsageExceptionSettings exceptionSettings = const UsageExceptionSettings(), required Iterable<UsageExceptionHandler> exceptionHandlers})
Replaces the standard exception handlers with the given exception handlers.

Properties

exceptionHandlers → List<UsageExceptionHandler>
no setter
exceptionSettings → UsageExceptionSettings
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sinks → OutputSinks
final
usageSettings → UsageSettings
final

Methods

addUsageExceptionHandler(UsageExceptionHandler handler) → void
Adds handler after the handlers already registered and before the standard handler.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onUsageException(UsageException exception, {required CommandDefinition<OptionDefinition>? fromCommand}) → UsageException?
Handles a usage exception by invoking the registered exception handlers. Returns the exception if it shall be rethrown, or null if it is suppressed.
printUsage(CommandDefinition<OptionDefinition> command, {StringSink? sink}) → void
Writes command's usage to sink, or to sinks.out when omitted (which is stdout unless overridden).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited