<commit_before>import yeoman from 'yeoman-environment';

const argv = require('minimist')(process.argv.slice(2));
const env = yeoman.createEnv();
const generators = [
  'app', 'component', 'container', 'list', 'reducer', 'navigation',
];
const supportedCommands = ['app'];

generators.forEach(g => env.register(`./baker/generators/${g}`, `rn:${g}`));

function defaultCommand() {
  env.run('rn:list');
}

function runCommand() {
  if (argv._.length !== 0) {
    const command = argv._[0];

    if (supportedCommands.indexOf(command) === -1) {
      return;
    }

    switch (command) {
      case 'app':
        env.run('rn', { baker: 'baker' });
        break;
      default:
        defaultCommand();
    }
  } else {
    defaultCommand();
  }
}

runCommand();<commit_msg>allow generate command to include app name arg<commit_after>import yeoman from 'yeoman-environment';

const argv = require('minimist')(process.argv.slice(2));
const env = yeoman.createEnv();
const generators = [
  'app', 'component', 'container', 'list', 'reducer', 'navigation',
];
const supportedCommands = ['app'];

generators.forEach(g => env.register(`./baker/generators/${g}`, `rn:${g}`));

function defaultCommand() {
  env.run('rn:list');
}

function setupApp() {
  const ops = { baker: 'baker' };
  if (argv._.length >= 2) {
    ops.name = argv._[1];
  }
  env.run('rn', ops);
}

function runCommand() {
  if (argv._.length !== 0) {
    const command = argv._[0];

    if (supportedCommands.indexOf(command) === -1) {
      return;
    }

    switch (command) {
      case 'app':
        setupApp();
        break;
      default:
        defaultCommand();
    }
  } else {
    defaultCommand();
  }
}

runCommand();
{'fraction_non_alphanumeric': 0.19011183048852265, 'fraction_numerical': 0.005885815185403178, 'mean_word_length': 3.3256997455470736, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '718367', 'n_tokens_mistral': 566, 'n_tokens_neox': 564, 'n_words': 121}