Fast printer engine with helper functions.

Primary

container-printer-machine?

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (container-printer-machine? x)

Type signature: Predicate

Returns true if object x directly implements IContainerPrinterMachine protocol, false otherwise.

invalid-item-handler

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (invalid-item-handler batch bm state config item parents)

Type signature:
  • (AnyBatch ⨯ BatchManager ⨯ IReference ⨯ {} ⨯ Any ⨯ IPersistentList) → Any

Returns nil if (:invalid-item config) is set to :ignore, returns (f batch bm state item parents) if (:invalid-item config) is a function, otherwise throws. This helper function is used inside printer machine for default handling of invalid items.

See also: perror

perror

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (perror & ms)

Type signature:
  • ((Va Any)) → nil

Throws printer engine error with a given messages ms.

pretty-printer-engine

Available since version 1.0 (view source)

not referred automatically

RETURNS TRANSDUCER

Usage:
  • (pretty-printer-engine machine-factory)

  • (pretty-printer-engine machine-factory coll)

Type signatures:
  • (IPrinterMachineFactory) → Transducer

  • (IPrinterMachineFactory ⨯ []) → IRed

Returns a transducer that prints step values according to printer machine-factory. Current implementation of printer engine requires that machine-factory prints to type which is supported by host batch manager.

See also: printer-engine

Available since version 1.0 (view source)

not referred automatically

MACRO (print! batch bm state & [x :as body])

Returns batch with stuff added, depending on the args passed into this macro. batch is used if it contains enough space, otherwise alternative batch shared through state is used.

TODO: list possible inputs

See also: print-colored!

Available since version 1.0 (view source)

not referred automatically

MACRO (print-colored! batch bm config state & [x :as body])

Returns batch with stuff added, depending on the args passed into this macro. batch is used if it contains enough space, otherwise alternative batch shared through state is used.

Resets color after printing is done.

See also: print!

printer-engine

Available since version 1.0 (view source)

not referred automatically

RETURNS TRANSDUCER

Usage:
  • (printer-engine machine-factory)

  • (printer-engine machine-factory coll)

Type signatures:
  • (IPrinterMachineFactory) → Transducer

  • (IPrinterMachineFactory ⨯ []) → IRed

Returns a transducer that prints step values according to printer machine-factory. Current implementation of printer engine requires that machine-factory prints to type which is supported by host batch manager.

Strips any ANSI colors from the output. Use pretty-printer-engine if you want to pretty print.

Colorer

black

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Black ANSI color.

blue

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Blue ANSI color.

bold-black

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold black ANSI color.

bold-blue

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold blue ANSI color.

bold-cyan

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold cyan ANSI color.

bold-green

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold green ANSI color.

bold-magenta

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold magenta ANSI color.

bold-red

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold red ANSI color.

bold-white

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold white ANSI color.

bold-yellow

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Bold yellow ANSI color.

color

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (color config state & keys)

Type signature:
  • ({} ⨯ IReference ⨯ (Va Keyword)) → (Maybe AnyBatch)

Returns a batch which sets the color of the output according to the keys, or returns nil if keys don’t map to any color. Uses function stored under :color-fn in config to perform the actual mapping.

Function to be used may be overriden from the state reference by setting :color-override in the referenced map to the overriding fn. The overriding is used e.g. in printing metadata.

custom-colorer

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (custom-colorer map)

Type signature:
  • (KeywordMap) → Function

Returns colorer which uses map to complement default colorer map.

See also: default-colorer

cyan

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Cyan ANSI color.

default-color

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

A default ANSI color.

default-colorer

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (default-colorer & keys)

Type signature:
  • ((Va Keyword)) → (Maybe AnyBatch)

Returns color for first found key, or returns nil if key(s) is/are not recognized.

See also: custom-colorer

green

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Green ANSI color.

magenta

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Magenta ANSI color.

red

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Red ANSI color.

white

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

White ANSI color.

yellow

Available since version 1.0 (view source)

not referred automatically

VAR of type AnyBatch

Yellow ANSI color.

Indentation

base-indent

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (base-indent config)

Type signature:
  • ({}) → (Maybe Integer+)

Returns base indentation value based on the given config. Uses :indent-size key in config to obtain the indentation size.

next-indent

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (next-indent config machine)

Type signature:
  • ({} ⨯ IIndentedMachine) → (Maybe Integer+)

Returns new indentation value based on the given config and parent machine. Uses :indent-size key in config to obtain the indentation size.

prev-indent

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (prev-indent config machine)

Type signature:
  • ({} ⨯ IIndentedMachine) → (Maybe Integer+)

Returns previous indentation value based on the given config and current machine. Uses :indent-size key in config to obtain the indentation size.