Logo Search packages:      
Sourcecode: jhbuild version File versions  Download package

def jhbuild::cut_n_paste::optparse::OptionContainer::add_option (   self,
  args,
  kwargs 
) [inherited]

add_option(Option)
   add_option(opt_str, ..., kwarg=val, ...)

Definition at line 999 of file optparse.py.

00999                                          :
        """add_option(Option)
           add_option(opt_str, ..., kwarg=val, ...)
        """
        if type(args[0]) is types.StringType:
            option = self.option_class(*args, **kwargs)
        elif len(args) == 1 and not kwargs:
            option = args[0]
            if not isinstance(option, Option):
                raise TypeError, "not an Option instance: %r" % option
        else:
            raise TypeError, "invalid arguments"

        self._check_conflict(option)

        self.option_list.append(option)
        option.container = self
        for opt in option._short_opts:
            self._short_opt[opt] = option
        for opt in option._long_opts:
            self._long_opt[opt] = option

        if option.dest is not None:     # option has a dest, we need a default
            if option.default is not NO_DEFAULT:
                self.defaults[option.dest] = option.default
            elif not self.defaults.has_key(option.dest):
                self.defaults[option.dest] = None

        return option

    def add_options(self, option_list):


Generated by  Doxygen 1.6.0   Back to index