Files
2024-09-17 01:37:27 -04:00

24 lines
563 B
Python

# Copyright (c) 2024 Microsoft Corporation.
# Licensed under the MIT License
"""CLI functions for the GraphRAG module."""
import argparse
from pathlib import Path
def file_exist(path):
"""Check for file existence."""
if not Path(path).is_file():
msg = f"File not found: {path}"
raise argparse.ArgumentTypeError(msg)
return path
def dir_exist(path):
"""Check for directory existence."""
if not Path(path).is_dir():
msg = f"Directory not found: {path}"
raise argparse.ArgumentTypeError(msg)
return path