Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/cli.py
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | def lister(ctx, config_file, db_url): | ||||
if db_url: | if db_url: | ||||
override_conf['lister'] = { | override_conf['lister'] = { | ||||
'cls': 'local', | 'cls': 'local', | ||||
'args': {'db': db_url} | 'args': {'db': db_url} | ||||
} | } | ||||
if not config_file: | if not config_file: | ||||
config_file = os.environ.get('SWH_CONFIG_FILENAME') | config_file = os.environ.get('SWH_CONFIG_FILENAME') | ||||
conf = config.read(config_file, override_conf) | conf = config.read(config_file, override_conf) | ||||
if not conf: | |||||
conf = override_conf | |||||
ctx.obj['config'] = conf | ctx.obj['config'] = conf | ||||
ctx.obj['override_conf'] = override_conf | |||||
@lister.command(name='db-init', context_settings=CONTEXT_SETTINGS) | @lister.command(name='db-init', context_settings=CONTEXT_SETTINGS) | ||||
@click.option('--drop-tables', '-D', is_flag=True, default=False, | @click.option('--drop-tables', '-D', is_flag=True, default=False, | ||||
help='Drop tables before creating the database schema') | help='Drop tables before creating the database schema') | ||||
@click.pass_context | @click.pass_context | ||||
def db_init(ctx, drop_tables): | def db_init(ctx, drop_tables): | ||||
"""Initialize the database model for given listers. | """Initialize the database model for given listers. | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |