CLI: Support a maxErrors option to limit the number of reported errors (fixes #664, fixes #238)

I started on #664 and remade this to be simpler and non-static.
this is backward inheritance. Seems very dirty.