output_helpers.ts

Declarations
#

4 declarations

view source

format_and_output
#

output_helpers.ts view source

<T>(data: T, formatters: OutputFormatters<T>, options: OutputOptions): Promise<void>

Formats data and outputs to file or stdout based on options.

Supports three formats: - stdout: Uses logger for colored/styled output (cannot use with --outfile) - json: Stringified JSON - markdown: Formatted markdown text

data

type T

formatters

type OutputFormatters<T>

options

returns

Promise<void>

throws

  • if - stdout format used with outfile, or if logger missing for stdout

OutputFormat
#

OutputFormatters
#

output_helpers.ts view source

OutputFormatters<T>

generics

T

json

type (data: T) => string

markdown

type (data: T) => Array<string>

stdout

This function should call log methods directly for colored/styled output.

type (data: T, log: Logger) => void

OutputOptions
#

Imported by
#