def command_line_options(command_line_arguments):
  """Parse the program options"""

  # set up command line parser
  parser = argparse.ArgumentParser(description=__doc__,
      formatter_class=argparse.ArgumentDefaultsHelpFormatter)

  parser.add_argument('-d', '--files', required=True, nargs='+', help = "A list of score files to evaluate.")
  parser.add_argument('-b', '--baselines', default=[], nargs='+', help = "A list of baseline results to add to the plot")

  parser.add_argument('-D', '--directory', default = '.', help = "A directory, where to find the --files")
  parser.add_argument('-B', '--baseline-directory', default = '.', help = "A directory, where to find the --baselines")

  parser.add_argument('-R', '--auto-baselines', choices = ('bioid', 'mit-cmu'), help = "Automatically add the baselines for the given database")

  parser.add_argument('-l', '--legends', nargs='+', help = "A list of legend strings used for ROC, CMC and DET plots; if given, must be the same number than --files plus --baselines.")
  parser.add_argument('-w', '--output', default = 'FROC.pdf', help = "If given, FROC curves will be plotted into the given pdf file.")
  parser.add_argument('-c', '--count-detections', action='store_true', help = "Counts the number of detections (positive is higher than negative, per file).")
  parser.add_argument('-n', '--max', type=int, nargs=2, default=(160,70), help = "The highest false alarms and the lowest detection rate to plot")
  parser.add_argument('-t', '--title', default='FROC', help = "The title of the plot")

  parser.add_argument('--self-test', action='store_true', help=argparse.SUPPRESS)

  # add verbosity option
  bob.core.log.add_command_line_option(parser)
  args = parser.parse_args(command_line_arguments)
  bob.core.log.set_verbosity_level(logger, args.verbose)

  if args.legends is not None:
    count = len(args.files) + (len(args.baselines) if args.baselines is not None else 0)
    if len(args.legends) != count:
      logger.error("The number of --files (%d) plus --baselines (%d) must be the same as --legends (%d)", len(args.files), len(args.baselines) if args.baselines else 0, len(args.legends))
      args.legends = None

  # update legends when they are not specified on command line
  if args.legends is None:
    args.legends = args.files if not args.baselines else args.files + args.baselines
    args.legends = [l.replace("_","-") for l in args.legends]

  if args.auto_baselines == 'bioid':
    args.baselines.extend(["baselines/baseline_detection_froba_mct_BIOID", "cosmin/BIOID/face.elbp.proj0.var.levels10.roc"])
    args.legends.extend(["Froba", "Cosmin"])
  elif args.auto_baselines == 'mit-cmu':
    args.baselines.extend(["baselines/baseline_detection_fcboost_MIT+CMU", "baselines/baseline_detection_viola_rapid1_MIT+CMU", "cosmin/MIT+CMU/face.elbp.proj0.var.levels10.roc"])
    args.legends.extend(["FcBoost", "Viola", "Cosmin"])

  return args