Expand description
File validation functions
This module provides functions to validate file paths according to
[ValidationRule::MustExist] and [ValidationRule::Extensions].
§Functions
validate_file_exists- Check if a file or directory existsvalidate_file_extension- Check if a file has an allowed extension
§Example
use dynamic_cli::validator::file_validator::{validate_file_exists, validate_file_extension};
use std::path::Path;
let path = Path::new("config.yaml");
// Validate file exists
validate_file_exists(path, "config_file")?;
// Validate file extension
let allowed = vec!["yaml".to_string(), "yml".to_string()];
validate_file_extension(path, "config_file", &allowed)?;Functions§
- validate_
file_ exists - Validate that a file or directory exists
- validate_
file_ extension - Validate that a file has one of the expected extensions