<commit_before>require('babel-register');
const program = require('commander');
const commands = require('./commands');
const blacklist = require('./helpers/blacklist');

program
  .version('0.4.0');

program
  .command('route [route]>')
  .description('Create a route and all its boilerplate code.')
  .option('-c, --component <component>', 'Specify a custom React component.')
  .option('-d, --delete', 'Delete an existing route.')
  .option('-l, --list', 'List all registered application routes, optionally providing a parent path to check child routes.')
  .action((route, options) => {
    if (options.list) {
      commands.list(route);
      return;
    }
    if (blacklist.test(route)) {
      return;
    }
    const component = typeof options.component === 'undefined'
      ? ''
      : options.component;
    if (options.delete) {
      commands.remove(route);
      return;
    }

    commands.create(route, component);<commit_msg>cli should fail when trying to create a regex route without a named component<commit_after>require('babel-register');
const program = require('commander');
const commands = require('./commands');
const blacklist = require('./helpers/blacklist');

program
  .version('0.4.0');

program
  .command('route [route]>')
  .description('Create a route and all its boilerplate code.')
  .option('-c, --component <component>', 'Specify a custom React component.')
  .option('-d, --delete', 'Delete an existing route.')
  .option('-l, --list', 'List all registered application routes, optionally providing a parent path to check child routes.')
  .action((route, options) => {
    // list all routes
    if (options.list) {
      commands.list(route);
      return;
    }

    // bail if route is blacklisted
    if (blacklist.test(route)) {
      return;
    }

    // delete route
    if (options.delete) {
      commands.remove(route);
      return;
    }

    // parse component option
    const component = typeof options.component === 'undefined'
      ? ''
      : options.component;

    // bail if route has any non-alpha characters and no named component
    if (!/^[a-zA-Z]*$/.test(route) && component === '') {
      console.log('Regex routes must have a named react component. Use --component=CustomName');
      return;
    }

    // perform route creation
    commands.create(route, component);
{'fraction_non_alphanumeric': 0.14852752880921896, 'fraction_numerical': 0.002560819462227913, 'mean_word_length': 3.1267605633802815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2528816', 'n_tokens_mistral': 666, 'n_tokens_neox': 651, 'n_words': 201}