function addOptions(flags, commandOptions) {
  // Start with the non-boolean options.
  flags.option('--referrer <name>',
      'Bracket output code with System.referrerName=<name>',
      (name) => {
        commandOptions.setOption('referrer', name);
        System.map = System.semverMap(name);
        return name;
      });
  flags.option('--modules <' + moduleOptions.join(', ') + '>',
      'select the output format for modules',
      (moduleFormat) => {
        commandOptions.modules = moduleFormat;
      });
  flags.option('--moduleName [true|false|default]',
    'true for named, false for anonymous modules; default depends on --modules',
    (moduleName) => {
      if (moduleName === 'true')
        moduleName = true;
      else if (moduleName === 'false')
        moduleName = false;
      else
        moduleName = 'default';
      commandOptions.moduleName = moduleName;
    });
  flags.option('--outputLanguage <es6|es5>',
    'compilation target language',
    (outputLanguage) => {
      if (outputLanguage === 'es6' || outputLanguage === 'es5')
        commandOptions.outputLanguage = outputLanguage;
      else
        throw new Error('outputLanguage must be one of es5, es6');
  });
  flags.option('--source-maps [file|inline|memory]',
    'sourceMaps generated to file or inline with data: URL',
    (to) => { return commandOptions.sourceMaps = to; }
  );
  flags.option('--source-root <true|false|string>',
    'sourcemap sourceRoot value. false to omit, ' +
        'true for directory of output file.',
    (to) => {
      if (to === 'false')
        to = false;
      else if (to === 'true')
        to = true;
      return commandOptions.sourceRoot = to;
    }
  );
  flags.option('--low-resolution-source-maps',
    'Lower sourceMaps granularity to one mapping per output line',
    () => { return commandOptions.lowResolutionSourceMap = true; }
  );
  flags.option('--experimental',
    'Turns on all experimental features',
    () => { commandOptions.experimental = true; }
  );

  flags.option('--atscript',
    'Turns on all AtScript features',
    () => { commandOptions.atscript = true; }
  );

  Object.keys(commandOptions).forEach(function(name) {
    let dashedName = toDashCase(name);
    if (flags.optionFor('--' + name) || flags.optionFor('--' + dashedName)) {
      return;   // non-boolean already in flags.
    } else if (name in featureOptions) {
      flags.option('--' + dashedName + ' [true|false|parse]',
                   descriptions[name]);
      flags.on(dashedName, (value) =>
        commandOptions.setOptionCoerced(dashedName, value));
    } else if (commandOptions[name] !== null) {
      flags.option('--' + dashedName, descriptions[name]);
      flags.on(dashedName, () => commandOptions.setOption(dashedName, true));
    } else {
      throw new Error('Unexpected null commandOption ' + name);
    }
  });
  // After we've processed the commandOptions, set defaults for commandOptions.
  commandOptions.setDefaults();
}
TODO(jjb): move to src/node
This is called by build.js to add options to the commander command line
library.
@param {Commander} flags The commander object.