.Dd 17 April 2017
.Dt PPBERT 1
.Os
.Sh NAME
.Nm ppbert
.Nd pretty print structures encoded in Erlang's External Term Format
.Sh SYNOPSIS
.Nm
.Op Ar OPTIONS
.Op Ar FILES Nm ...
.Sh DESCRIPTION
.Nm
parses and pretty prints a ETF-encoded file.
The files can either be passed on the command-line
piped through stdin.
.Pp
.Nm
accepts the following options:
.Bl -tag -width Ds
.It Fl i Ar num , Fl -indent-width Ar num
Set the indentation to
.Ar num
spaces. Default = 2.
.It Fl m Ar num , Fl -max-terms-per-line Ar num
Set the maximum number of basic terms
(i.e., numbers, strings, atoms)
that may be printed on a single line.
Default = 4.
.It Fl v , -verbose
Show the time it takes to parse and pretty print
a file.
.It Fl s , -skip-pretty-print
Do not pretty print the file, simply parse it.
Useful to verify if a file is well-formed.
.It Fl h , -help
Display help
.It Fl V , -version
Display version
.El
.Sh RETURN VALUES
.Nm
returns 0 if all files have been successfully processed,
and 1 if any file failed to parse.
.Sh COMPATIBILITY
.Nm
supports a subset of the types supported by the
Erlang External Term Format, namely those that can
represent data structures (see the list below).
.Nm
does not support types such as PIDs, ports,
references, or functions.
.Pp
Supported types:
.Bl -bullet -width Ds
.It
Small integers (tag: 97);
.It
Integers (tag: 98);
.It
Floating-point numbers (tags: 70, 99);
.It
Big integers (tags: 110, 111);
.It
Latin-1 atoms (tags: 100, 115);
.It
UTF-8 atoms (tags: 118, 119);
.It
Strings (tag: 107);
.It
Binaries (tag: 109);
.It
Tuples (tags: 104, 105);
.It
Lists (tags: 106, 108);
.It
Maps (tag: 116).
.El
.Sh EXAMPLES
Pretty print the file foo.bert.
.Bd -literal -offset indent
$ ppbert foo.bert
.Ed
.Pp
Pretty print from stdin
.Bd -literal -offset indent
$ printf "\ex83\ex77\ex04atom" | ppbert
.Ed