loam/cli.py
def _add_options_to_parser(self, opts_dict, parser):
        """Add options to a parser."""
        store_bool = ('store_true', 'store_false')
        for opt, sct in opts_dict.items():
            meta = self._conf[sct].def_[opt]
            kwargs = copy.deepcopy(meta.cmd_kwargs)
            action = kwargs.get('action')
            if action is internal.Switch:
                kwargs.update(nargs=0)
            elif meta.default is not None and action not in store_bool:
                kwargs.setdefault('type', type(meta.default))
            kwargs.update(help=meta.help)
            kwargs.setdefault('default', self._conf[sct][opt])
            parser.add_argument(*_names(self._conf[sct], opt), **kwargs)
def _add_options_to_parser(self, opts_dict, parser):
        """Add options to a parser."""
        store_bool = ('store_true', 'store_false')
        for opt, sct in opts_dict.items():
            meta = self._conf[sct].def_[opt]
            kwargs = copy.deepcopy(meta.cmd_kwargs)
            action = kwargs.get('action')
            if action is internal.Switch:
                kwargs.update(nargs=0)
            elif meta.default is not None and action not in store_bool:
                kwargs.setdefault('type', type(meta.default))
            kwargs.update(help=meta.help)
            kwargs.setdefault('default', self._conf[sct][opt])
            parser.add_argument(*_names(self._conf[sct], opt), **kwargs)
Add options to a parser.