def parseCommandLine(self, line):
    """
    Parse the given command line and populate self with the values found.

    If the command line doesn't conform to the specification defined
    by this CLI object, this function prints a message to stdout indicating
    what was wrong, prints the program usage instructions and then exists
    the program

    :param line: list of tokens from the command line. Should have had program
                 name removed - generally one would do this: sys.argv[1:]
    """
    # separate arguments and options
    try:
      optlist, args = getopt.getopt(line, self._optlist(), self._longoptl())
    except getopt.GetoptError, err:
      print str(err)
      self.usage()
      sys.exit(2)

    # parse options
    for opt, arg in optlist:
      opt = opt.lstrip("-")
      found = False
      for option in self.options:
        if option.short == opt or option.long == opt:
          option.value = option.type(arg)
          option.set = True
          found = True
      if not found:
        sys.stderr.write("unknown option: " + opt)
        self.usage()
        sys.exit(2)

    # check for special options
    specialOptions = False
    for opt in self.options:
      if opt.special and opt.isSet():
        specialOptions = True

    # parse arguments
    if len(args) < self.minArgs and not specialOptions:
      err = (str(len(args)) + " input arguments found, but required at " +
             "least " + str(self.minArgs) + " arguments")
      sys.stderr.write(err)
      sys.stderr.write("\n\n")
      self.usage()
      sys.exit(2)
    else:
      self.args = args

    # check for required options
    for option in self.options:
      if option.isRequired() and not option.isSet() and not specialOptions:
        err = "required option \'" + str(option) + "\' is missing"
        sys.stderr.write(err)
        print "\n"
        self.usage()
        sys.exit(2)
Parse the given command line and populate self with the values found.

    If the command line doesn't conform to the specification defined
    by this CLI object, this function prints a message to stdout indicating
    what was wrong, prints the program usage instructions and then exists
    the program

    :param line: list of tokens from the command line. Should have had program
                 name removed - generally one would do this: sys.argv[1:]