diff --git a/mqtt_sniffer.py b/mqtt_sniffer.py index 3388f83..1432200 100644 --- a/mqtt_sniffer.py +++ b/mqtt_sniffer.py @@ -44,7 +44,10 @@ class MqttSniffer(App): """a textual application for viewing mqtt messages.""" CSS_PATH = "style.tcss" - BINDINGS = [("q", "quit", "Quit")] + BINDINGS = [ + ("q", "quit", "Quit"), + ("c", "clear_screen", "Clear") + ] MAX_LOGS = 50 def __init__(self, args, password): @@ -102,6 +105,11 @@ class MqttSniffer(App): self.log_display.write(message) + def action_clear_screen(self): + self.all_logs = [] + self._update_display() + + def _update_display(self): """Clean the display and render all mqtt messages based on the current filters.""" self.log_display.clear()