diff options
Diffstat (limited to 'datamaps/main.py')
-rw-r--r-- | datamaps/main.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/datamaps/main.py b/datamaps/main.py index f607e6e..407727d 100644 --- a/datamaps/main.py +++ b/datamaps/main.py @@ -32,7 +32,7 @@ from engine.exceptions import (DatamapFileEncodingError, MissingCellKeyError, MissingLineError, MissingSheetFieldError, NoApplicableSheetsInTemplateFiles, - RemoveFileWithNoSheetRequiredByDatamap) + RemoveFileWithNoSheetRequiredByDatamap, DatamapNotCSVException) logging.basicConfig(level=logging.INFO, format="%(asctime)s: %(levelname)s - %(message)s", datefmt='%d-%b-%y %H:%M:%S') logger = logging.getLogger(__name__) @@ -103,10 +103,15 @@ def report(): default=False, help="Create master.xlsx immediately", ) -def templates(to_master): +@click.option( + "--datamap", + "-d", + help="Path to datamap file", +) +def templates(to_master, datamap): if to_master: try: - engine_cli.import_and_create_master(echo_funcs=output_funcs) + engine_cli.import_and_create_master(echo_funcs=output_funcs, datamap=datamap) except MalFormedCSVHeaderException as e: click.echo( click.style("Incorrect headers in datamap. {}.".format(e.args[0]), bold=True, reverse=True, fg="cyan")) @@ -128,6 +133,9 @@ def templates(to_master): except DatamapFileEncodingError as e: logger.critical(e) sys.exit(1) + except DatamapNotCSVException as e: + logger.critical(e) + sys.exit(1) else: click.secho("Not implemented yet. Try --to-master/-m flag") |