Cli.Report

This module is an abstraction on top of Cli.PrettyPrinter with a default layout and some standard options that we like to use in the Gren compiler.

If you want your command line application to output messages in the same style as the Gren compiler, then this is the package to use.

type Report

A message to the user. We tend to use Reports for error messages and warnings.

empty : Report

The empty report. Equivalent to no output at all.

create : String -> Maybe Path -> Document -> Report

A report has a title, a message and (optionally) a file path to the file that is relevant to the report.

type OutputType
= Terminal ({ useColor : Bool })
| Json

How do you want to format the report? Use Json when you expect your CLI to be read by a script.

toString : OutputType -> (Path -> String) -> Report -> String

Turn the report into a string that can be written to the stdout stream. If you target something other than stdout, make sure you've disabled colors or use the Json output type.

prettyPrint : { useColor : Bool } -> Document -> String

An oppinionated PrettyPrint.toString.