0.1
This commit is contained in:
10
main.py
10
main.py
@@ -1,8 +1,9 @@
|
||||
# main.py
|
||||
import json
|
||||
from pathlib import Path
|
||||
from utils.texttools import split_display_sections
|
||||
from models.hpe5130 import SwitchHPE5130
|
||||
from output.export_json import export_switch_to_json
|
||||
|
||||
|
||||
|
||||
def read_file_with_fallback(path: Path) -> str:
|
||||
@@ -14,7 +15,7 @@ def read_file_with_fallback(path: Path) -> str:
|
||||
|
||||
|
||||
def main():
|
||||
log_path = Path("data/example-a.log")
|
||||
log_path = Path("data/example.log")
|
||||
if not log_path.exists():
|
||||
print(f"Fichier non trouvé : {log_path}")
|
||||
return
|
||||
@@ -27,10 +28,7 @@ def main():
|
||||
switch.parse_block(section["section"], section["content"])
|
||||
|
||||
output_path = Path("data/switch_parsed.json")
|
||||
with open(output_path, "w", encoding="utf-8") as f:
|
||||
json.dump(switch.to_dict(), f, indent=2, ensure_ascii=False)
|
||||
|
||||
print(f"Switch exporté dans {output_path}")
|
||||
export_switch_to_json(switch, output_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user