import click CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) @click.group(context_settings = CONTEXT_SETTINGS) def cli(): pass @cli.group() def db(): """Database Management""" pass @db.command() def init(): """Initialize the database, if not done already.""" from .model import create_all create_all() @db.command() @click.confirmation_option(prompt="Are you sure you want to drop the database?") def drop(): """Completely drop all tables.""" from .model import drop_all drop_all()