69e4e06940
Правила: id не ru.shturman.*, shturman_api поддержан, len(tiles)<=ui_tiles, vehicle_read из каталога.
Фикстуры good + bad-{id-reserved,api,tiles-quota,vehicle-read}; 6 тестов.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Alexander <akotenev2003@gmail.com>
37 lines
1.0 KiB
Rust
37 lines
1.0 KiB
Rust
//! Валидатор манифеста плагина (F02). `shturman-manifest-validator <manifest.yaml>`.
|
|
|
|
mod validate;
|
|
|
|
use std::process::ExitCode;
|
|
|
|
fn main() -> ExitCode {
|
|
let Some(path) = std::env::args().nth(1) else {
|
|
eprintln!("usage: shturman-manifest-validator <manifest.yaml>");
|
|
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
|
|
}
|
|
}
|
|
}
|