#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import syd
import click

# -----------------------------------------------------------------------------
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])


@click.command(context_settings=CONTEXT_SETTINGS)
@click.argument('filename')
@click.option('--overwrite/--no-overwrite', default=False)
@click.option('--folder', default='data',
              help='Change the data folder, which is data by default')
def syd_create(filename, folder, overwrite):
    """
    Create an empty db
    """

    # create the db
    syd.create_db(filename, folder, overwrite)
    db = syd.open_db(filename)

    # print file and folder
    print("Database: {}".format(db.absolute_filename))
    print("Image folder: {}".format(db.absolute_data_folder))
    print("export SYD_DB_FILENAME=" + filename)


# -----------------------------------------------------------------------------
if __name__ == '__main__':
    syd_create()
