CliOutput
Formats CLI help and errors as text.
This module turns help documents, CLI errors, grouped errors, and version information into strings. It does not write those strings to the terminal itself. It includes the Formatter interface, the formatter service, a layer for custom formatters, and the default formatter with configurable color support.
Constructors
defaultFormatter
Added in v4.0.0
Source
Signature
declare function defaultFormatter(options?: { colors?: boolean }): Formatter;Layers
Models
Defines the service interface for formatting CLI output including help, errors, and version info. This allows customization of output formatting, including color support.
Signature
interface Formatter {
readonly formatCliError: (error: CliError) => string;
readonly formatError: (error: CliError) => string;
readonly formatErrors: (errors: readonly Array<CliError>) => string;
readonly formatHelpDoc: (doc: HelpDoc) => string;
readonly formatVersion: (name: string, version: string) => string;
}
Creates a default formatter with configurable options.