Expand description
File validation utilities
This module provides functions for validating file paths, including checking for file existence and validating file extensions.
§Example
use dynamic_cli::validator::{validate_file_exists, validate_file_extension};
use std::path::Path;
let path = Path::new("config.yaml");
// Check if file exists
validate_file_exists(path, "config")?;
// Check if extension is allowed
let allowed = vec!["yaml".to_string(), "yml".to_string()];
validate_file_extension(path, "config", &allowed)?;
Functions§
- validate_
file_ exists - Validate that a file or directory exists at the given path.
- validate_
file_ extension - Validate that a file has an allowed extension.