Skip to content

Commit d75fb7a

Browse files
committed
fixed problems with booleans
1 parent a119495 commit d75fb7a

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

‎bin/convert-argv.js‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ module.exports = function(optimist, argv, convertOptions) {
2323
}, init);
2424
}
2525

26-
function mapArgToBoolean(name, optionName) {
26+
function ifBooleanArg(name, fn) {
2727
ifArg(name, function(bool) {
28-
options[optionName] = bool;
28+
if(bool) fn();
29+
});
30+
}
31+
32+
function mapArgToBoolean(name, optionName) {
33+
ifBooleanArg(name, function() {
34+
options[optionName] = true;
2935
});
3036
}
3137

@@ -147,9 +153,9 @@ module.exports = function(optimist, argv, convertOptions) {
147153
options.output.publicPath = value;
148154
});
149155

150-
ifArg("output-pathinfo", function(bool) {
156+
ifBooleanArg("output-pathinfo", function() {
151157
ensureObject(options, "output");
152-
options.output.pathinfo = bool;
158+
options.output.pathinfo = true;
153159
});
154160

155161
ifArg("output-library", function(value) {
@@ -172,8 +178,7 @@ module.exports = function(optimist, argv, convertOptions) {
172178

173179
mapArgToBoolean("debug", "debug");
174180

175-
ifArg("progress", function(value) {
176-
if(!value) return;
181+
ifBooleanArg("progress", function() {
177182
var ProgressPlugin = require("../lib/ProgressPlugin");
178183
ensureArray(options, "plugins");
179184
var chars = 0;
@@ -214,9 +219,9 @@ module.exports = function(optimist, argv, convertOptions) {
214219
options.optimize.maxChunks = parseInt(value, 10);
215220
});
216221

217-
ifArg("optimize-minimize", function(bool) {
222+
ifBooleanArg("optimize-minimize", function() {
218223
ensureObject(options, "optimize");
219-
options.optimize.minimize = bool;
224+
options.optimize.minimize = true;
220225
});
221226

222227
ifArg("plugin", function(value) {

0 commit comments

Comments
 (0)