class Shell(cmd.Cmd): def __init__(self): cmd.Cmd.__init__(self) self.core = Core() self.core.list() self.intro = "\nDecision Support System Logger: For information type help or ? \n" self.prompt = ">> " self.completekey = 'tab' self._hist = [] self._locals = [] self._globals = [] def precmd(self, line): self._hist += [line.strip()] return line def postcmd(self, stop, line): return stop def empyline(self): pass def default(self, line): try: exec line in self._locals, self._globals except Exception, e: print e.__class__, ":", e
def do_list(self,args): dss_core = Core() dss_core.list()