Never a wrong chart

A file pcmp can't draw exactly is refused in one line, and no PNG is written.

What it does

Any character the font can't draw, an unknown key, a negative value or text too long for its line is refused with one line naming the file and the field, and no PNG is written.

pcmp's tests draw every chart in its README and compare it with the image there.

  • One line, the field named

    The line starts pcmp: , names the file and, where it can, the field, line and column.

    $ pcmp bad.toml
    pcmp: bad.toml: groups[0].rows[0].values holds -612: values are finite and zero or more
  • Exit codes a script can trust

    0 when every chart was drawn; 1 when the data file couldn't be read or drawn, or a PNG couldn't be written; 2 when the command line is wrong, answered the way clap-based tools do.

  • Never through a symlink

    Each chart is written to DIR/<the data file's name>-<kind>.png, overwriting one already there but never through a symlink, and its path printed on its own line.

How to use it

  1. Draw a file, then read the exit code: anything but 0 means no chart to trust.

    pcmp bad.toml --out charts

What is refused

Each is refused with the field it is in.

  • A character the font can't draw

    The font draws A to Z (lower case in capitals), 0 to 9, space and . , : ; - + / ( ) % = < > ' _ | × * †.

  • A value out of range

    A value that is negative, not a number or above 1e15, or a ratio outside 1e-15 to 1e15.

  • Too much

    More than 12 parties, or text too long for its line, such as a title over 41 characters.

  • An unknown key

    A key the data format doesn't have.

Read it. Run it. It's MIT.

The code is MIT licensed, © Catalin Ilinca: read it, fork it, ship it in your own work. Its name and logos, and PITO MD's, are © Catalin Ilinca, all rights reserved, and are not covered by the MIT licence.