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.
nvm, I had this backwards.