//! Валидатор манифеста плагина (F02). `shturman-manifest-validator `. mod validate; use std::process::ExitCode; fn main() -> ExitCode { let Some(path) = std::env::args().nth(1) else { eprintln!("usage: shturman-manifest-validator "); return ExitCode::from(2); }; let yaml = match std::fs::read_to_string(&path) { Ok(s) => s, Err(e) => { eprintln!("не прочитать {path}: {e}"); return ExitCode::from(2); } }; match validate::validate_yaml(&yaml) { Err(e) => { eprintln!("✗ {e}"); ExitCode::FAILURE } Ok(errs) if errs.is_empty() => { println!("✓ манифест валиден: {path}"); ExitCode::SUCCESS } Ok(errs) => { eprintln!("✗ нарушений: {}", errs.len()); for e in errs { eprintln!(" - {e}"); } ExitCode::FAILURE } } }