up arrow
This commit is contained in:
@@ -8,12 +8,17 @@ from .util import *
|
||||
from time import sleep, time
|
||||
from threading import Thread
|
||||
from nullptr.central_command import CentralCommand
|
||||
import readline
|
||||
import os
|
||||
|
||||
class CommandError(Exception):
|
||||
pass
|
||||
|
||||
class Commander(CommandLine):
|
||||
def __init__(self, store_file='data/store.npt'):
|
||||
def __init__(self, store_file='data/store.npt', hist_file = 'data/cmd.hst'):
|
||||
self.hist_file = hist_file
|
||||
if os.path.isfile(hist_file):
|
||||
readline.read_history_file(hist_file)
|
||||
self.store = Store(store_file)
|
||||
self.agent = self.select_agent()
|
||||
self.api = Api(self.store, self.agent)
|
||||
@@ -26,6 +31,7 @@ class Commander(CommandLine):
|
||||
|
||||
def handle_eof(self):
|
||||
self.store.close()
|
||||
readline.write_history_file(self.hist_file)
|
||||
print("Goodbye!")
|
||||
|
||||
def prompt(self):
|
||||
|
||||
Reference in New Issue
Block a user