Skip to content

Formatting Agency code

Agency ships with a formatter that you can run on a single file, a list of files, or whole directories. You can use format or its alias fmt:

agency format foo.agency
agency fmt src/

Formatting normalizes vertical whitespace: runs of blank lines collapse to a single blank line, and the sorted import block is followed by exactly one. Code literal bodies ([| ... |]) are reformatted like any other code.

By default, the formatted output is printed to stdout. If no input is given, the formatter reads from stdin, which makes it easy to wire up to an editor or a pipeline:

cat foo.agency | agency fmt

Options

  • -i, --in-place — overwrite the input file(s) with the formatted output instead of printing to stdout.