mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 13:31:32 +00:00
Refactor HistoryMonitor
This commit is contained in:
parent
44a1433d3b
commit
491eaf6d5e
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user