@@ -14,7 +14,7 @@ const collectValues = extension => extension.split(',')
14
14
15
15
const commander = require ( 'commander' )
16
16
. name ( 'jsonlint' )
17
- . usage ( '[options] [<pattern> ...]' )
17
+ . usage ( '[options] [<file, directory, pattern> ...]' )
18
18
. description ( description )
19
19
. option ( '-s, --sort-keys' , 'sort object keys (not when prettifying)' )
20
20
. option ( '-E, --extensions [ext]' , 'file extensions to process for directory walk' , collectValues , [ 'json' , 'JSON' ] )
@@ -30,6 +30,7 @@ const commander = require('commander')
30
30
. option ( '-e, --environment [env]' , 'which specification of JSON Schema the validation file uses' )
31
31
. option ( '-l, --log-files' , 'print only the parsed file names to stdout' )
32
32
. option ( '-q, --quiet' , 'do not print the parsed json to stdout' )
33
+ . option ( '-n, --continue' , 'continue with other files if an error occurs' )
33
34
. option ( '-p, --pretty-print' , 'prettify the input instead of stringifying the parsed object' )
34
35
. option ( '-P, --pretty-print-invalid' , 'force pretty-printing even for invalid input' )
35
36
. option ( '-r, --trailing-newline' , 'ensure a line break at the end of the output' )
@@ -57,6 +58,9 @@ const options = commander.opts()
57
58
const extensions = options . extensions . map ( extension => '.' + extension )
58
59
59
60
function logNormalError ( error , file ) {
61
+ if ( process . exitCode > 0 ) {
62
+ console . log ( )
63
+ }
60
64
console . log ( 'File:' , file )
61
65
console . error ( error . message )
62
66
}
@@ -135,7 +139,11 @@ function processContents (source, file) {
135
139
logNormalError ( e , file )
136
140
}
137
141
}
138
- process . exit ( 1 )
142
+ if ( options . continue ) {
143
+ process . exitCode = 1
144
+ } else {
145
+ process . exit ( 1 )
146
+ }
139
147
}
140
148
}
141
149
0 commit comments