def parseCommandLine(self, line):
<EOL>try:<EOL><INDENT>optlist, args = getopt.getopt(line, self._optlist(), self._longoptl())<EOL><DEDENT>except getopt.GetoptError as err:<EOL><INDENT>print(str(err))<EOL>self.usage()<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT>for opt, arg in optlist:<EOL><INDENT>opt = opt.lstrip("<STR_LIT:->")<EOL>found = False<EOL>for option in self.options:<EOL><INDENT>if option.short == opt or option.long == opt:<EOL><INDENT>option.value = option.type(arg)<EOL>option.set = True<EOL>found = True<EOL><DEDENT><DEDENT>if not found:<EOL><INDENT>sys.stderr.write("<STR_LIT>" + opt)<EOL>self.usage()<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT><DEDENT>specialOptions = False<EOL>for opt in self.options:<EOL><INDENT>if opt.special and opt.isSet():<EOL><INDENT>specialOptions = True<EOL><DEDENT><DEDENT>if len(args) < self.minArgs and not specialOptions:<EOL><INDENT>err = (str(len(args)) + "<STR_LIT>" +<EOL>"<STR_LIT>" + str(self.minArgs) + "<STR_LIT>")<EOL>sys.stderr.write(err)<EOL>sys.stderr.write("<STR_LIT>")<EOL>self.usage()<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>self.args = args<EOL><DEDENT>for option in self.options:<EOL><INDENT>if option.isRequired() and not option.isSet() and not specialOptions:<EOL><INDENT>err = "<STR_LIT>" + str(option) + "<STR_LIT>"<EOL>sys.stderr.write(err)<EOL>print("<STR_LIT:\n>")<EOL>self.usage()<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT><DEDENT>
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:]