#!/usr/bin/env node

/**
 * Created by geweimin on 17/7/14.
 */

// var script = process.argv[1];
// var installedGlobally = script.indexOf('node_modules/.bin/react-native') === -1;
//
// if (installedGlobally) {
//   const chalk = require('chalk');
//
//   console.error([
//     chalk.red('Looks like you installed react-native globally, maybe you meant react-native-cli?'),
//     chalk.red('To fix the issue, run:'),
//     'npm uninstall -g react-native',
//     'npm install -g react-native-cli'
//   ].join('\n'));
//   process.exit(1);
// } else {
//   require('./cli').run();
// }


var script = process.argv[2];
if (script === 'init') {
  console.log('process.argv' + process.argv);
  require('./init/init')(process.argv[3]);
} else {
  const chalk = require('chalk');
  console.error([
    chalk.red('UnKnow of \'mxf ' + script +'\''),
    chalk.red('you can try:'),
    'mxf init AwesomeProject'
  ].join('\n'));
  process.exit(1);
}
