1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-01-17 08:48:05 +00:00
thatmattlove-hyperglass/hyperglass/parsing/common.py
2020-10-10 21:12:30 -07:00

17 lines
459 B
Python

"""Command parsers applied to all unstructured output."""
def remove_command(commands: str, output: str) -> str:
"""Remove anything before the command if found in output."""
_output = output.strip().split("\n")
for command in commands:
for line in _output:
if command in line:
idx = _output.index(line) + 1
_output = _output[idx:]
return "\n".join(_output)
parsers = (remove_command,)