blob: 01c0b57d6acb2761696b7f491acfefffab85f4c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
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()
|