Refactor HistoryMonitor

This commit is contained in:
Kristóf Tóth 2019-06-27 16:19:51 +02:00
parent 44a1433d3b
commit 491eaf6d5e
1 changed files with 8 additions and 12 deletions

View File

@ -21,7 +21,6 @@ class HistoryMonitor(ABC, InotifyObserver):
See examples below.
"""
def __init__(self, uplink, histfile):
self._domain = ''
self.histfile = histfile
self.history = []
self._last_length = len(self.history)
@ -29,12 +28,9 @@ class HistoryMonitor(ABC, InotifyObserver):
super().__init__(self.histfile)
@property
@abstractmethod
def domain(self):
return self._domain
@domain.setter
def domain(self, domain):
self._domain = domain
raise NotImplementedError()
def on_modified(self, event):
self._fetch_history()
@ -78,9 +74,9 @@ class BashMonitor(HistoryMonitor):
shopt -s histappend
unset HISTCONTROL
"""
def __init__(self, uplink, histfile):
super().__init__(uplink, histfile)
self.domain = 'bash'
@property
def domain(self):
return 'bash'
@property
def command_pattern(self):
@ -95,9 +91,9 @@ class GDBMonitor(HistoryMonitor):
HistoryMonitor to monitor GDB sessions.
For this to work "set trace-commands on" must be set in GDB.
"""
def __init__(self, histfile):
super().__init__(histfile)
self.domain = 'gdb'
@property
def domain(self):
return 'gdb'
@property
def command_pattern(self):