about summary refs log tree commit diff
path: root/scripts/cli
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cli')
-rw-r--r--scripts/cli/validators.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/cli/validators.py b/scripts/cli/validators.py
index 6d16e4c..dc198f5 100644
--- a/scripts/cli/validators.py
+++ b/scripts/cli/validators.py
@@ -2,6 +2,14 @@
 from pathlib import Path
 
 
+def file_exists(val: str) -> Path:
+    """Ensure the file path specified actually exists."""
+    _file = Path(val)
+    if _file.exists() and _file.is_file():
+        return _file
+    raise FileNotFoundError(f"Could not find the file '{_file}'.")
+
+
 def directory_exists(val: str) -> Path:
     """Check that directory path specified actually exists."""
     _dir = Path(val).absolute()