aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2021-01-22 21:17:37 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2021-01-22 21:17:37 +0000
commit5eed8ff03fcb80ca86f2c782d8994edae06effae (patch)
tree1b45912e1c733b17e104babf2ac91224d4b79c66
parent440c886cfe58129cf2930cea043fd270e6115ca6 (diff)
fixed bug whereby relative paths could not be used for cli flags
-rw-r--r--datamaps/__init__.py2
-rw-r--r--datamaps/main.py21
-rw-r--r--pyproject.toml2
3 files changed, 19 insertions, 6 deletions
diff --git a/datamaps/__init__.py b/datamaps/__init__.py
index 6849410..a82b376 100644
--- a/datamaps/__init__.py
+++ b/datamaps/__init__.py
@@ -1 +1 @@
-__version__ = "1.1.0"
+__version__ = "1.1.1"
diff --git a/datamaps/main.py b/datamaps/main.py
index a2c7e03..444b56f 100644
--- a/datamaps/main.py
+++ b/datamaps/main.py
@@ -22,6 +22,7 @@ import logging
import sys
from click import version_option
from functools import partial
+from pathlib import Path
from datamaps import __version__
from engine.adapters import cli as engine_cli
@@ -126,8 +127,9 @@ def restart():
@_config.command(
- short_help="Shows location of the config.ini file. This differs depending "
- "upon your operating system.")
+ short_help="Shows location of the config.ini file. This differs depending "
+ "upon your operating system."
+)
def show_file():
"""
Shows location of the config file.
@@ -143,7 +145,9 @@ def show_file():
default=False,
help="Create master.xlsx based on populated templates and datamap.csv in input directory.",
)
-@click.option("--datamap", "-d", help="Path to datamap file", metavar="CSV_FILE_PATH")
+@click.option(
+ "--datamap", "-d", help="Path to datamap file", type=Path, metavar="CSV_FILE_PATH"
+)
@click.option(
"--rowlimit",
type=int,
@@ -151,7 +155,10 @@ def show_file():
"Default is 500.",
)
@click.option(
- "--inputdir", help="Path to input directory", metavar="INPUT_DIRECTORY_PATH"
+ "--inputdir",
+ help="Path to input directory",
+ type=Path,
+ metavar="INPUT_DIRECTORY_PATH",
)
@click.option(
"--validationonly",
@@ -198,6 +205,12 @@ def templates(to_master, datamap, rowlimit, inputdir, validationonly):
a validation report. This may provide another almost inperceptible performance benefit as producing
the master file is quite expensive.
"""
+ if datamap:
+ if not datamap.is_absolute():
+ datamap = Path.cwd() / datamap
+ if inputdir:
+ if not inputdir.is_absolute():
+ inputdir = Path.cwd() / inputdir
if rowlimit == 0:
logging.critical("Row limit cannot be 0. Quitting.")
sys.exit(1)
diff --git a/pyproject.toml b/pyproject.toml
index d8fd9a0..b1b309a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
[tool.poetry]
name = "datamaps"
-version = "1.1.0"
+version = "1.1.1"
homepage = "https://github.com/hammerheadlemon/datamaps"
repository = "https://github.com/hammerheadlemon/datamaps"
license = "MIT"