From 74e7e70e768cc9d8d113f96f6f10539d9a5112c7 Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Wed, 20 May 2015 10:29:56 -0700 Subject: [PATCH] [ReactNative] Cleanup _build_bundle script --- parseCommandLine.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/parseCommandLine.js b/parseCommandLine.js index 65061e3f..17a2d8af 100644 --- a/parseCommandLine.js +++ b/parseCommandLine.js @@ -24,12 +24,21 @@ function parseCommandLine(config) { // optimist default API requires you to write the command name three time // This is a small wrapper to accept an object instead for (var i = 0; i < config.length; ++i) { + if (config[i].type === 'string') { + optimist.string(config[i].command); + } else { + optimist.boolean(config[i].command); + } + optimist - .boolean(config[i].command) .default(config[i].command, config[i].default) .describe(config[i].command, config[i].description); + + if (config[i].required) { + optimist.demand(config[i].command); + } } - var argv = optimist.argv; + var argv = optimist.parse(process.argv); // optimist doesn't have support for --dev=false, instead it returns 'false' for (var i = 0; i < config.length; ++i) {