def parse_options(self, arg):
        """
        Parse options with the argv

        :param arg: one arg from argv
        """

        if not arg.startswith('-'):
            return False

        value = None
        if '=' in arg:
            arg, value = arg.split('=')

        for option in self._option_list:

            if arg not in (option.shortname, option.longname):
                continue

            action = option.action
            if action:
                action()

            if option.key == option.shortname:
                self._results[option.key] = True
                return True

            if option.boolean and option.default:
                self._results[option.key] = False
                return True

            if option.boolean:
                self._results[option.key] = True
                return True

            # has tag, it should has value
            if not value:
                if self._argv:
                    value = self._argv[0]
                    self._argv = self._argv[1:]

            if not value:
                raise RuntimeError('Missing value for: %s' % option.name)

            self._results[option.key] = option.to_python(value)
            return True

        return False
def parse_options ( self , arg ) : if not arg . startswith ( '-' ) : return False value = None if '=' in arg : arg , value = arg . split ( '=' ) for option in self . _option_list : if arg not in ( option . shortname , option . longname ) : continue action = option . action if action : action ( ) if option . key == option . shortname : self . _results [ option . key ] = True return True if option . boolean and option . default : self . _results [ option . key ] = False return True if option . boolean : self . _results [ option . key ] = True return True if not value : if self . _argv : value = self . _argv [ 0 ] self . _argv = self . _argv [ 1 : ] if not value : raise RuntimeError ( 'Missing value for: %s' % option . name ) self . _results [ option . key ] = option . to_python ( value ) return True return False
Parse options with the argv

        :param arg: one arg from argv