about summary refs log tree commit diff
path: root/scripts/cli/validators.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cli/validators.py')
-rw-r--r--scripts/cli/validators.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/cli/validators.py b/scripts/cli/validators.py
new file mode 100644
index 0000000..6d16e4c
--- /dev/null
+++ b/scripts/cli/validators.py
@@ -0,0 +1,10 @@
+"""CLI options validators."""
+from pathlib import Path
+
+
+def directory_exists(val: str) -> Path:
+    """Check that directory path specified actually exists."""
+    _dir = Path(val).absolute()
+    if _dir.is_dir() and _dir.exists():
+        return _dir
+    raise FileNotFoundError(f"The path '{_dir}' MUST exist and be a directory.")