Skip to main content

validate_file_exists

Function validate_file_exists 

Source
pub fn validate_file_exists(path: &Path, arg_name: &str) -> Result<()>
Expand description

Validate that a file or directory exists at the given path.

§Arguments

  • path - The path to check
  • arg_name - The argument name (used in error messages)

§Returns

  • Ok(()) if the path exists
  • Err(ValidationError::FileNotFound) if the path does not exist

§Example

use dynamic_cli::validator::validate_file_exists;
use std::path::Path;

validate_file_exists(Path::new("config.yaml"), "config")?;