Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/updater/ghtorrent/cli.py
# Copyright (C) 2018 The Software Heritage developers | # Copyright (C) 2018 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import click | import click | ||||
import logging | |||||
from swh.scheduler.updater.ghtorrent import GHTorrentConsumer | |||||
@click.command() | @click.command() | ||||
@click.option('--verbose/--no-verbose', '-v', default=False, | @click.option('--verbose/--no-verbose', '-v', default=False, | ||||
help='Verbose mode') | help='Verbose mode') | ||||
def main(verbose): | @click.pass_context | ||||
def main(ctx, verbose): | |||||
"""Consume events from ghtorrent and write them to cache. | """Consume events from ghtorrent and write them to cache. | ||||
""" | """ | ||||
log = logging.getLogger('swh.scheduler.updater.ghtorrent.cli') | click.echo("Deprecated! Use 'swh-scheduler updater' instead.", | ||||
log.addHandler(logging.StreamHandler()) | err=True) | ||||
_loglevel = logging.DEBUG if verbose else logging.INFO | ctx.exit(1) | ||||
log.setLevel(_loglevel) | |||||
GHTorrentConsumer().run() | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
main() | main() |