File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,21 @@ var argv = require('yargs')
21
21
, default : 2
22
22
, describe : 'specifying tabulation spaces'
23
23
, type : 'number'
24
- } )
24
+ } ) . option ( 'r' , {
25
+ alias : 'lintable'
26
+ , default : false
27
+ , describe : 'output valid json'
28
+ , type : 'boolean'
29
+ } )
25
30
. example ( 'jsome -cl /some/dir/file.json' , 'print out the content of file.json in color displaying indentation levels' )
26
31
. example ( 'jsome -c false -l /some/dir/file.json' , 'print out the content of file.json without color but with indentation levels' )
27
32
. help ( 'h' )
28
33
. argv ;
29
34
30
- jsome . params . colored = argv . c ;
31
- jsome . level . show = argv . l ;
32
- jsome . level . spaces = argv . s ;
35
+ jsome . params . colored = argv . c ;
36
+ jsome . params . lintable = argv . r ;
37
+ jsome . level . show = argv . l ;
38
+ jsome . level . spaces = argv . s ;
33
39
34
40
var filePath = argv . _ [ 0 ] || '' ;
35
41
Original file line number Diff line number Diff line change @@ -73,7 +73,13 @@ module.exports = (function () {
73
73
}
74
74
75
75
function colorifySpec ( char , type , level ) {
76
- return generateLevel ( level ) + useColorProvider ( '' + char , jsomeRef . colors [ type ] ) ;
76
+ var quote = (
77
+ jsomeRef . params . lintable && type === 'attr'
78
+ ? colorifySpec ( '"' , 'quot' , 0 )
79
+ : ''
80
+ )
81
+ return generateLevel ( level ) + quote
82
+ + useColorProvider ( '' + char , jsomeRef . colors [ type ] ) + quote ;
77
83
}
78
84
79
85
function useColorProvider ( str , color ) {
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ var colors = {
22
22
, params = {
23
23
'colored' : true
24
24
, 'async' : false
25
+ , 'lintable' : false
25
26
}
26
27
27
28
You can’t perform that action at this time.
0 commit comments