nodeca/js-yaml — pull request #32 by scrooloose (2011-12-19 22:46:04+00:00)
Title: Add --compact option to emit errors on one line and use nomnom

There are 2 changes here.

1 - Use nomnom to parse command line args
2. Allow the user to specify --compact which causes error messages to be displayed on one line

The reason for wanting one line error messages is to make it easier to parse so that it can be incorporated into syntasitc, a syntax checker plugin for vim (https://github.com/scrooloose/syntastic).

In this patch, some error message content is omitted when --compact is used. Namely `context`, `contextMark`, and the error snippet and pointer. To illustrate, here is an error without --compact:

marty@zugzug:~/projects/js-yaml> ./bin/js-yaml.js /tmp/foo.yml
while scanning a simple key
in "", line 5, column 1:
;;*9())
^
could not found expected ':'
in "", line 7, column 1:

^

and here is the same error with --compact

marty@zugzug:~/projects/js-yaml> ./bin/js-yaml.js --compact /tmp/foo.yml
could not found expected ':' in "", line 7, column 1

I should probably note that I am a n00b at javascript so if you want to pull then its probably a good idea to review the changes pretty closely, and if i have missed something or if something could be done better then just comment and ill take care of it.