32 lines
801 B
Python
Executable File
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)
|