-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvalidate_toon
More file actions
33 lines (22 loc) · 855 Bytes
/
validate_toon
File metadata and controls
33 lines (22 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def validate_comparison(yaml_path: Path, toon_path: Path) -> int:
if not yaml_path.exists():
return handle_file_not_found(yaml_path)
if not toon_path.exists():
return handle_file_not_found(toon_path)
print(f"🔍 Validating: {yaml_path.name} vs {toon_path.name}")
print("=" * 60)
yaml_data = load_yaml(yaml_path)
toon_data = load_file(toon_path)
if not yaml_data or not toon_data:
return handle_load_failure()
results = compare_all(yaml_data, toon_data)
print_comparison_summary(results)
return 0 if all(result[1] for result in results) else 1
def handle_file_not_found(filepath: Path) -> int:
print(f"Error: {filepath} not found")
sys.exit(1)
return 1
def handle_load_failure() -> int:
print("Error: Could not load one or both files")
sys.exit(1)
return 1