@@ -32,6 +32,15 @@ var continueProcessing = true,
32
32
// so use this to set the exit code
33
33
process . on ( 'exit' , function ( ) { process . reallyExit ( currentErrorcode ) } ) ;
34
34
35
+ var checkArgFunc = function ( arg , option ) {
36
+ if ( ! option ) {
37
+ sys . puts ( arg + " option requires a parameter" ) ;
38
+ continueProcessing = false ;
39
+ return false ;
40
+ }
41
+ return true ;
42
+ }
43
+
35
44
args = args . filter ( function ( arg ) {
36
45
var match ;
37
46
@@ -78,9 +87,11 @@ args = args.filter(function (arg) {
78
87
options . yuicompress = true ;
79
88
break ;
80
89
case 'max-line-len' :
81
- options . max_line_len = parseInt ( match [ 2 ] , 10 ) ;
82
- if ( options . max_line_len <= 0 ) {
83
- options . max_line_len = - 1 ;
90
+ if ( checkArgFunc ( arg , match [ 2 ] ) ) {
91
+ options . maxLineLen = parseInt ( match [ 2 ] , 10 ) ;
92
+ if ( options . maxLineLen <= 0 ) {
93
+ options . maxLineLen = - 1 ;
94
+ }
84
95
}
85
96
break ;
86
97
case 'no-color' :
@@ -90,10 +101,7 @@ args = args.filter(function (arg) {
90
101
options . ieCompat = false ;
91
102
break ;
92
103
case 'include-path' :
93
- if ( ! match [ 2 ] ) {
94
- sys . puts ( "include-path option requires a parameter" ) ;
95
- continueProcessing = false ;
96
- } else {
104
+ if ( checkArgFunc ( arg , match [ 2 ] ) ) {
97
105
options . paths = match [ 2 ] . split ( os . type ( ) . match ( / W i n d o w s / ) ? ';' : ':' )
98
106
. map ( function ( p ) {
99
107
if ( p ) {
@@ -106,14 +114,13 @@ args = args.filter(function (arg) {
106
114
case 'O1' : options . optimization = 1 ; break ;
107
115
case 'O2' : options . optimization = 2 ; break ;
108
116
case 'line-numbers' :
109
- options . dumpLineNumbers = match [ 2 ] ;
117
+ if ( checkArgFunc ( arg , match [ 2 ] ) ) {
118
+ options . dumpLineNumbers = match [ 2 ] ;
119
+ }
110
120
break ;
111
121
case 'rp' :
112
122
case 'rootpath' :
113
- if ( ! match [ 2 ] ) {
114
- sys . puts ( "rootpath option requires a parameter" ) ;
115
- continueProcessing = false ;
116
- } else {
123
+ if ( checkArgFunc ( arg , match [ 2 ] ) ) {
117
124
options . rootpath = match [ 2 ] . replace ( / \\ / g, '/' ) ;
118
125
}
119
126
break ;
@@ -206,7 +213,7 @@ var parseLessFile = function (e, data) {
206
213
ieCompat : options . ieCompat ,
207
214
compress : options . compress ,
208
215
yuicompress : options . yuicompress ,
209
- max_line_len : options . max_line_len ,
216
+ maxLineLen : options . maxLineLen ,
210
217
strictMaths : options . strictMaths ,
211
218
strictUnits : options . strictUnits
212
219
} ) ;
0 commit comments