Module file_validator

Module file_validator 

Source
Expand description

File validation functions

This module provides functions to validate file paths according to [ValidationRule::MustExist] and [ValidationRule::Extensions].

§Functions

§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