@@ -52,13 +52,19 @@ module.exports = function(optimist, argv, convertOptions) {
5252
5353 function mapArgToBoolean ( name , optionName ) {
5454 ifBooleanArg ( name , function ( ) {
55- options [ optionName ] = true ;
55+ options [ optionName || name ] = true ;
56+ } ) ;
57+ }
58+
59+ function mapArgToBooleanInverse ( name , optionName ) {
60+ ifArg ( name , function ( bool ) {
61+ if ( ! bool ) options [ optionName || name ] = false ;
5662 } ) ;
5763 }
5864
5965 function mapArgToPath ( name , optionName ) {
6066 ifArg ( name , function ( str ) {
61- options [ optionName ] = path . resolve ( str ) ;
67+ options [ optionName || name ] = path . resolve ( str ) ;
6268 } ) ;
6369 }
6470
@@ -228,8 +234,8 @@ module.exports = function(optimist, argv, convertOptions) {
228234 options . target = value ;
229235 } ) ;
230236
231- mapArgToBoolean ( "cache" , "cache" ) ;
232- mapArgToBoolean ( "watch" , "watch" ) ;
237+ mapArgToBooleanInverse ( "cache" ) ;
238+ mapArgToBoolean ( "watch" ) ;
233239
234240 ifArg ( "watch-delay" , function ( value ) {
235241 options . watchDelay = value ;
@@ -241,7 +247,7 @@ module.exports = function(optimist, argv, convertOptions) {
241247 options . plugins . push ( new HotModuleReplacementPlugin ( ) ) ;
242248 } ) ;
243249
244- mapArgToBoolean ( "debug" , "debug" ) ;
250+ mapArgToBoolean ( "debug" ) ;
245251
246252 ifBooleanArg ( "progress" , function ( ) {
247253 var ProgressPlugin = require ( "../lib/ProgressPlugin" ) ;
@@ -358,9 +364,9 @@ module.exports = function(optimist, argv, convertOptions) {
358364 options . plugins . push ( loadPlugin ( value ) ) ;
359365 } ) ;
360366
361- mapArgToBoolean ( "bail" , "bail" ) ;
367+ mapArgToBoolean ( "bail" ) ;
362368
363- mapArgToBoolean ( "profile" , "profile" ) ;
369+ mapArgToBoolean ( "profile" ) ;
364370
365371 if ( ! options . output || ! options . output . filename ) {
366372 ensureObject ( options , "output" ) ;
0 commit comments