diff options
Diffstat (limited to '')
-rw-r--r-- | archivist/cli.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/archivist/cli.py b/archivist/cli.py new file mode 100644 index 0000000..95b19d3 --- /dev/null +++ b/archivist/cli.py @@ -0,0 +1,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(force): + """Completely drop all tables.""" + from .model import drop_all + drop_all() |