iblrig.commands.dir_path
- iblrig.commands.dir_path(directory)[source]
Convert a string to a Path object and check if the directory exists.
This function is intended for use as a type conversion function with argparse. It takes a string argument representing a directory path, converts it into a Path object, and checks if the directory exists. If the directory exists, it returns the Path object; otherwise, it raises an argparse.ArgumentError with an appropriate error message.
- Parameters:
directory (
str
) – A string representing a directory path.- Returns:
A Path object representing the directory.
- Return type:
- Raises:
argparse.ArgumentError – If the directory does not exist, an argparse.ArgumentError is raised with an error message indicating that the directory was not found.
- Parameters:
directory (str)