This repository has been archived on 2025-03-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
omci_decoder/main.py
2024-09-13 19:35:36 -03:00

32 lines
801 B
Python
Executable File

#!/usr/bin/env python3
import os
import sys
from pathlib import Path
from src import message
def parse_msgs(file_path: Path) -> list[str]:
lines: list[str]
with open(file_path) as file:
lines = [line.rstrip() for line in file]
msgs: list[str] = []
for line in lines:
if "capture:" in line:
start_index = line.index("capture:") + len("capture:")
msgs.append(line[start_index:].strip())
return msgs
if __name__ == "__main__":
term_size: os.terminal_size = os.get_terminal_size()
for arg in sys.argv[1:]:
msgs = parse_msgs(Path(arg))
for msg in msgs:
msg_omci = message.OMCIMessage(msg)
print("-" * term_size.columns)
print(msg_omci)
print("-" * term_size.columns)