A command-line utility to pretty print structures encoded using Erlang's External Term Format. The input is read from stdin or a file and written to stdout, making ppbert a good candidate for shell pipelines.
At the moment, ppbert supports the following subset of the External Term Format:
``` $ ppbert -h ppbert 0.6.0-rc1 Vincent Foley Pretty print structure encoded in Erlang's External Term Format
USAGE: ppbert [FLAGS] [OPTIONS] [FILES]...
FLAGS: -2, --bert2 Parses .bert2 files -d, --disk-log Parses disk_log files -h, --help Prints help information -j, --json Outputs in JSON -p, --parse Parses the input, doesn't pretty print it --transform-proplists Transforms proplists into JSON objects (only valid with --json) -V, --version Prints version information -v, --verbose Enables verbose mode
OPTIONS:
-i, --indent-width
ARGS:
$ ppbert mini_dict.bert [ {host, "localhost"}, {port, 80}, { headers, [ { <<"X-Real-Ip">>, {127, 0, 0, 1} }, {<<"Keep-alive">>, true} ] } ]
$ printf "\x83\x77\x04atom" | ppbert atom ```
Ppbert is written in Rust and offers an appreciable performance gain
over using Erlang's erlang:binary_to_term/1
and io:format/2
.
```sh $ cat erl_ppbert
main(Args) -> lists:foreach(fun (Filename) -> {ok, Binary} = file:readfile(Filename), io:format("~p~n", [binaryto_term(Binary)]) end, Args).
$ du large.bert 96M large.bert
$ time ./erl_ppbert large.bert >/dev/null
real 0m43.017s user 0m38.846s sys 0m4.345s
$ time ppbert large.bert >/dev/null
real 0m1.802s user 0m1.251s sys 0m0.549s ```
A command-line utility to convert a bert file encoded in bertconf's DB format to rig's format.
``` $ bert-convert -h bert-convert 0.6.0-rc1 Vincent Foley Convert bertconf .bert files to rig .bert2 files
USAGE: bert-convert [FLAGS] [OPTIONS] [FILES]...
FLAGS: -h, --help Prints help information -V, --version Prints version information -v, --verbose Enables verbose mode
OPTIONS: -d, --output-dir
ARGS:
$ bert-convert -v -d /tmp/bert2 large.bert bert-convert: large.bert: Parse time: 0.556925379s; Dump time: 0.580329024s
$ ls /tmp/bert2 large.bert2 ```