(self, opts_string, opt_where="CMD_OPT")
Declare in advance options that are part of the command line
Declare in advance options that are part of the command line
Declare in advance options that are part of the command line
def declare_options(self, opts_string, opt_where="CMD_OPT"):
        """Declare in advance options that are part of the command line
        """
        pos = 0
        opt_list = self._argv_split[opt_where]
        while pos < len(opt_list):
            for opt_name in opts_string.strip().split():
                if opt_name.endswith('='):
                    if opt_list[pos].startswith(opt_name):
                        self._argv_consumed_options[opt_where].append(pos)
                    elif opt_list[pos] == opt_name[:-1]:
                        self._argv_consumed_options[opt_where].append(pos)
                        if pos + 1 == len(opt_list):
                            break   # error -x without argument at end of line
                        if (pos < len(opt_list) and
                                not opt_list[pos+1].startswith('-')):
                            self._argv_consumed_options[opt_where].\
                                append(pos + 1)
                elif opt_list[pos] == opt_name:
                    self._argv_consumed_options[opt_where].append(pos)
            pos += 1
def declare_options ( self , opts_string , opt_where = "CMD_OPT" ) : pos = 0 opt_list = self . _argv_split [ opt_where ] while pos < len ( opt_list ) : for opt_name in opts_string . strip ( ) . split ( ) : if opt_name . endswith ( '=' ) : if opt_list [ pos ] . startswith ( opt_name ) : self . _argv_consumed_options [ opt_where ] . append ( pos ) elif opt_list [ pos ] == opt_name [ : - 1 ] : self . _argv_consumed_options [ opt_where ] . append ( pos ) if pos + 1 == len ( opt_list ) : break # error -x without argument at end of line if ( pos < len ( opt_list ) and not opt_list [ pos + 1 ] . startswith ( '-' ) ) : self . _argv_consumed_options [ opt_where ] . append ( pos + 1 ) elif opt_list [ pos ] == opt_name : self . _argv_consumed_options [ opt_where ] . append ( pos ) pos += 1