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