Skip to content

Add --compact option to emit errors on one line and use nomnom#32

Closed
scrooloose wants to merge 2 commits intonodeca:masterfrom
scrooloose:add-compact
Closed

Add --compact option to emit errors on one line and use nomnom#32
scrooloose wants to merge 2 commits intonodeca:masterfrom
scrooloose:add-compact

Conversation

@scrooloose
Copy link
Copy Markdown
Contributor

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 "<unicode string>", line 5, column 1:
    ;;*9())
    ^
could not found expected ':'
 in "<unicode string>", 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 "<unicode string>", 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.

@ixti
Copy link
Copy Markdown
Contributor

ixti commented Dec 20, 2011

Thanks for your pull request.
We want to keep js-yaml lib with as less dependencies as possible.
In fact, executable file was made here just for demo purposes only.

But your change makes sense, so we have moved jsyaml executable
into separate module: js-yaml.bin
where we have put your changes in for executable.

I'll put your changes to Error classes in next few moments.
Thank you.

@ixti ixti closed this Dec 20, 2011
ixti added a commit that referenced this pull request Dec 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants