'use strict';

var path = require('path');
var yeoman = require('yeoman-environment');

function init(projectDir, argsOrName) {
  console.log('Setting up new React Native app in ' + projectDir);
  var env = yeoman.createEnv();
  env.register(require.resolve(path.join(__dirname, 'generator')), 'react:app');
  var args = Array.isArray(argsOrName) ? argsOrName : [argsOrName].concat(process.argv.slice(4));
  var generator = env.create('react:app', {args: args});
  generator.destinationRoot(projectDir);
  generator.run();
}

module.exports = init;

@@ -81,16 +81,288 @@
 ent');%0A%0A
+// argsOrName can be:%0A// - A string (e.g. 'AwesomeApp'). This is the common case when%0A//   you run 'react-native init AwesomeApp' from the command line.%0A// - An array with all the arguments. This can be useful when you%0A//   need to pass custom arguments to the generator.%0A
 function
@@ -573,16 +573,140 @@
 :app');%0A
+  // argv is e.g.%0A  // %5B'node', 'react-native', 'init', 'AwesomeApp', '--verbose'%5D%0A  // args is %5B'AwesomeApp', '--verbose'%5D%0A
   var ar

Add a comment to CLI's init