def start(self, param_string=None):
external_opt = {}<EOL>self.get_options_from_environ(external_opt)<EOL>self.get_options_from_file(external_opt)<EOL>optargs = {}<EOL>reqargs, varargs = [], []<EOL>if param_string is None:<EOL><INDENT>argv = sys.argv[<NUM_LIT:1>:]<EOL><DEDENT>else:<EOL><INDENT>import shlex<EOL>argv = shlex.split(param_string)<EOL><DEDENT>self._eval_variables()<EOL>i = <NUM_LIT:0><EOL>while i < len(argv):<EOL><INDENT>x = argv[i]<EOL>if x in self._help_options:<EOL><INDENT>self._print_help()<EOL>return<EOL><DEDENT>if x in self._version_options and self._get_variable('<STR_LIT>'):<EOL><INDENT>self._print_version()<EOL>return<EOL><DEDENT>if x in self.options:<EOL><INDENT>o_x = self.options[x]<EOL>oe_x = self.options_equ[x]<EOL>if oe_x in optargs:<EOL><INDENT>raise RunnerError("<STR_LIT>" % x)<EOL><DEDENT>if isinstance(o_x, (list, tuple)):<EOL><INDENT>argpos = i<EOL>optargs[oe_x] = []<EOL>i += <NUM_LIT:1><EOL>while i < len(argv) and argv[i] not in self.options:<EOL><INDENT>try:<EOL><INDENT>optargs[oe_x].append(type(o_x[<NUM_LIT:0>])(argv[i]))<EOL><DEDENT>except ValueError:<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" %<EOL>(i - argpos, x, self._format_type(o_x[<NUM_LIT:0>])))<EOL><DEDENT>except IndexError:<EOL><INDENT>optargs[oe_x].append(argv[i])<EOL><DEDENT>i += <NUM_LIT:1><EOL><DEDENT>if not len(optargs[oe_x]) and not len(o_x):<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" % x)<EOL><DEDENT>if len(o_x) and len(optargs[oe_x]) != len(o_x):<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" %<EOL>(x, len(o_x), self._format_type(o_x[<NUM_LIT:0>]), len(optargs[oe_x])))<EOL><DEDENT><DEDENT>elif type(o_x) is bool:<EOL><INDENT>optargs[oe_x] = True<EOL>i += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>i += <NUM_LIT:1><EOL>if i >= len(argv) or argv[i] in self.options:<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" %<EOL>(x, self._format_type(o_x)))<EOL><DEDENT>try:<EOL><INDENT>optargs[oe_x] = type(o_x)(argv[i])<EOL><DEDENT>except ValueError:<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" %<EOL>(x, self._format_type(o_x)))<EOL><DEDENT>i += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>if x.startswith('<STR_LIT:->'):<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" % argv[i])<EOL><DEDENT>elif len(reqargs) < len(self.reqargs):<EOL><INDENT>reqargs.append(argv[i])<EOL><DEDENT>elif self.varargs:<EOL><INDENT>varargs.append(argv[i])<EOL><DEDENT>else:<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" % argv[i])<EOL><DEDENT>i += <NUM_LIT:1><EOL><DEDENT><DEDENT>if self.reqargs and len(reqargs) < len(self.reqargs):<EOL><INDENT>raise RunnerErrorWithUsage("<STR_LIT>" % len(self.reqargs))<EOL><DEDENT>options = OrderedDict(self.python_options)<EOL>options.update(external_opt)<EOL>options.update(optargs)<EOL>allargs = reqargs<EOL>allargs.extend(options.values())<EOL>allargs.extend(varargs)<EOL>if DEBUG:<EOL><INDENT>print('<STR_LIT>', allargs)<EOL><DEDENT>return self.func(*allargs)<EOL>
Parses command line parameters
            A string can be passed to simulate a cli for test purpose