From d5d0a0cfba45b32a63eb4dcc8b347df39e7425e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Bigio?= Date: Tue, 22 Sep 2015 09:00:04 -0700 Subject: [PATCH] Introduce react native CLI Reviewed By: @frantic Differential Revision: D2430522 --- parseCommandLine.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parseCommandLine.js b/parseCommandLine.js index 36b8ab11..4293b79b 100644 --- a/parseCommandLine.js +++ b/parseCommandLine.js @@ -20,7 +20,8 @@ var optimist = require('optimist'); -function parseCommandLine(config) { +function parseCommandLine(config, args) { + args = args || process.argv; // 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) { @@ -38,7 +39,7 @@ function parseCommandLine(config) { optimist.demand(config[i].command); } } - var argv = optimist.parse(process.argv); + var argv = optimist.parse(args); // optimist doesn't have support for --dev=false, instead it returns 'false' for (var i = 0; i < config.length; ++i) {