Command history now also is implemented
This commit is contained in:
24
bin/others/history_manager.py
Normal file
24
bin/others/history_manager.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import bin.com.csv_parsers
|
||||
|
||||
cvr = bin.com.csv_parsers.CsvRead()
|
||||
cvw = bin.com.csv_parsers.CsvWrite()
|
||||
|
||||
|
||||
class HistroyManager:
|
||||
def __init__(self):
|
||||
self.__history = []
|
||||
self.__history_mod = []
|
||||
|
||||
def append_history(self, command, path):
|
||||
try:
|
||||
self.__history_mod = cvr.importing(path).pop(0)
|
||||
except IndexError:
|
||||
pass
|
||||
if command != "":
|
||||
self.__history_mod.insert(0, command)
|
||||
cvw.write_str(path, self.__history_mod)
|
||||
else:
|
||||
pass
|
||||
|
||||
def get_history(self, path):
|
||||
return cvr.importing(path)
|
||||
Reference in New Issue
Block a user