Changeset View
Changeset View
Standalone View
Standalone View
swh/core/cli/__init__.py
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | def swh(ctx, log_level): | ||||
ctx.ensure_object(dict) | ctx.ensure_object(dict) | ||||
ctx.obj['log_level'] = log_level | ctx.obj['log_level'] = log_level | ||||
def main(): | def main(): | ||||
logging.basicConfig() | logging.basicConfig() | ||||
# load plugins that define cli sub commands | # load plugins that define cli sub commands | ||||
for entry_point in pkg_resources.iter_entry_points('swh.cli.subcommands'): | for entry_point in pkg_resources.iter_entry_points('swh.cli.subcommands'): | ||||
try: | |||||
cmd = entry_point.load() | cmd = entry_point.load() | ||||
swh.add_command(cmd, name=entry_point.name) | swh.add_command(cmd, name=entry_point.name) | ||||
except Exception as e: | |||||
ardumont: .warning or else you will have a warning about it | |||||
logger.warning('Could not load subcommand %s: %s', | |||||
entry_point.name, str(e)) | |||||
return swh(auto_envvar_prefix='SWH') | return swh(auto_envvar_prefix='SWH') | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
main() | main() |
.warning or else you will have a warning about it