function processArgs(args) {
  const processedArgs = {
    basePath: '',
    output: '',
    overwriteExistingFiles: true,
    paths: [],
    recursive: false,
  };
  args.forEach((arg) => {
    const [key, value] = arg.split('=');
    switch (key) {
      case '--base':
        processedArgs.basePath = value;
        break;
      case '--dep_file':
        processedArgs.depsFile = value;
        break;
      case '--help':
        showHelp();
        break;
      case '--recursive':
        processedArgs.recursive = String(value).toLowerCase() !== 'false';
        break;
      case '--output':
        processedArgs.output = value;
        break;
      case '--overwrite':
        processedArgs.overwriteExistingFiles =
            String(value).toLowerCase() !== 'false';
        break;
      default:
        const stats = fs.statSync(arg);
        processedArgs.paths.push({path: arg, directory: stats.isDirectory()});
    }
  });

  if (!processedArgs.basePath.endsWith('base.js')) {
    throw new Error(
        `Path to base must end with base.js: ${processedArgs.basePath}.`);
  }

  if (processedArgs.output) {
    if (processedArgs.paths.length > 1) {
      throw new Error(
          'Cannot specify an output file when there is more than one path.');
    }
    if (processedArgs.paths.some(path => path.directory)) {
      throw new Error('Cannot specify an output when path is a directory.');
    }
    if (!processedArgs.output.endsWith('_test.html')) {
      throw new Error('Output file should end with _test.html.');
    }
  }

  if (processedArgs.depsFile && !fs.existsSync(processedArgs.depsFile)) {
    throw new Error(
        'Specified deps file does not exist: ' + processedArgs.depsFile);
  }

  return processedArgs;
}
@param {!Array<string>} args
@return {!Args}