Example #1
0
    def run(self):
        self.welcome()
        while True:
            # READ
            inp = self.input(self.prompt)

            # EVAL
            cmd = parse(literal_string(inp))
            try:
                out = self.do(cmd)
            except EOFError:
                return
            except QuitREPL:
                return

            # PRINT
            if out is not None:
                self.output(out)
Example #2
0
 def repl_input(self, msg):
     self.script.write(msg)
     groups = self.script.expect(re.compile('(?P<cmd>.*)')).groupdict()
     cmd = literal_string(groups['cmd'])
     env.logger_r.info("command rev: {}".format(cmd))
     return cmd