The preserves-tool program is a swiss army knife for translating Preserves document syntax to and from various surface syntaxes, for stripping annotations, and for pretty-printing.

It reads Preserves Values (either a fixed number (--count) or until EOF (--all)) from stdin, autodetecting binary or text syntax for each by default, and prints the same Values either using the same or a different Preserves syntax on stdout. By default, it will print using text syntax with pretty-printing.


Install Racket. Then, raco pkg install preserves.


usage: preserves-tool [ <option> ... ]

<option> is one of

     Text to binary
     Read until EOF (default)
  --count <n>
     Read n items
     Binary to text
  --ia, --input-any
     Autodetect input mode (default)
  --ib, --input-binary
     Set binary input mode
  --it, --input-text
     Set text input mode
  --ob, --output-binary
     Set binary output mode
  --ot, --output-text
     Set text output mode (default)
     Enable indent and set text output mode (default)
     Disable indent and set text output mode
     Output annotations (default)
     Strip annotations
  --help, -h
     Show this help
     Do not treat any remaining argument as a switch (at this level)

 Multiple single-letter switches can be combined after
 one `-`. For example, `-h-` is the same as `-h --`.