function getConfig() {
  const args = process.argv.slice(2);
  const argv = minimist(args, {
    boolean: ['comment', 'help'],
    default: {comment: true},
    alias: {help: 'h'}
  });
  const config = {};

  if (argv.help) {
    printUsageAndExit();
  }

  config.testUrl = argv._[0];
  if (!config.testUrl) {
    console.log('Please provide a url to test.');
    printUsageAndExit();
  }

  config.addComment = argv.comment;
  config.thresholds = {};
  if ('perf' in argv) {
    config.thresholds.performance = Number(argv.perf);
  }
  if ('pwa' in argv) {
    config.thresholds.pwa = Number(argv.pwa);
  }
  if ('seo' in argv) {
    config.thresholds.seo = Number(argv.seo);
  }
  if ('a11y' in argv) {
    config.thresholds.accessibility = Number(argv.a11y);
  }
  if ('bp' in argv) {
    config.thresholds['best-practices'] = Number(argv.bp);
  }

  if (!config.addComment && !Object.keys(config.thresholds).length) {
    console.log(`Please provide a threshold score for at least one category
      (pwa,perf,seo,a11y) when using --no-comment.]\n`);
    printUsageAndExit();
  }

  config.runner = argv.runner || RUNNERS.chrome;
  const possibleRunners = Object.keys(RUNNERS);
  if (!possibleRunners.includes(config.runner)) {
    console.log(
      `Unknown runner "${config.runner}". Options: ${possibleRunners}`);
    printUsageAndExit();
  }
  console.log(`Using runner: ${config.runner}`);

  config.pr = {
    number: parseInt(process.env.TRAVIS_PULL_REQUEST, 10),
    sha: process.env.TRAVIS_PULL_REQUEST_SHA
  };

  const repoSlug = process.env.TRAVIS_PULL_REQUEST_SLUG;
  if (!repoSlug) {
    throw new Error('This script can only be run on Travis PR requests.');
  }

  config.repo = {
    owner: repoSlug.split('/')[0],
    name: repoSlug.split('/')[1]
  };

  return config;
}
Collects command lines flags and creates settings to run LH CI.
@return {!Object} Settings object.