Fixes command validity check for local-cli.

Summary:
Prior to the RNPM integration, command names would match the second argument passed to the react-native-cli. Now the command names contain some usage information (such as non-flag CLI arguments). This commit splits the name of the commands and checks that against the second command line argument.
Closes https://github.com/facebook/react-native/pull/9171

Differential Revision: D3661799

fbshipit-source-id: dc2aa9cd9e69dde3c5b877aeb77a17c4f6427075
This commit is contained in:
Eric Rozell 2016-08-03 00:53:05 -07:00 committed by Facebook Github Bot 1
parent de517a84e8
commit 4ce431b9cf
1 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,7 @@ function run() {
commander.parse(process.argv);
const isValidCommand = commands.find(cmd => cmd.name === process.argv[2]);
const isValidCommand = commands.find(cmd => cmd.name.split(' ')[0] === process.argv[2]);
if (!isValidCommand) {
printUnknownCommand(process.argv[2]);