From 726d45b182c105f930e56e8bf6415c3014b819dd Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" Date: Fri, 27 Jul 2018 10:21:38 +0200 Subject: [PATCH] swh.lister.cli: Factorize supported listers --- swh/lister/cli.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/swh/lister/cli.py b/swh/lister/cli.py index 0eacaea..82a217a 100644 --- a/swh/lister/cli.py +++ b/swh/lister/cli.py @@ -6,13 +6,16 @@ import click +SUPPORTED_LISTERS = ['github', 'gitlab', 'bitbucket', 'debian'] + + @click.command() @click.option( '--db-url', '-d', default='postgres:///lister-gitlab.com', help='SQLAlchemy DB URL; see ' '') # noqa @click.option('--lister', required=1, - type=click.Choice(['github', 'gitlab', 'bitbucket', 'debian']), + type=click.Choice(SUPPORTED_LISTERS), help='Lister to act upon') @click.option('--create-tables', is_flag=True, default=False, help='create tables') @@ -22,7 +25,6 @@ def cli(db_url, lister, create_tables, drop_tables): """Initialize db model according to lister. """ - supported_listers = ['github', 'gitlab', 'bitbucket', 'debian'] override_conf = {'lister_db_url': db_url} if lister == 'github': @@ -48,7 +50,7 @@ def cli(db_url, lister, create_tables, drop_tables): _lister = DebianLister() else: - raise ValueError('Only supported listers are %s' % supported_listers) + raise ValueError('Only supported listers are %s' % SUPPORTED_LISTERS) if drop_tables: ModelBase.metadata.drop_all(_lister.db_engine)