def interact()

in ftw_compatible_tool/user_interface.py [0:0]


    def interact(self):
        """ Start interactive user interface.
        """
        def auto_completer(text, state):
            text = text.lower()
            keywords = [
                "load",
                "gen",
                "start",
                "import",
                "report",
                "exit",
            ]
            if text:
                candidates = [
                    candidate for candidate in keywords
                    if candidate.startswith(text)
                ]
            else:
                candidates = keywords
            if state < len(candidates):
                return candidates[state]
            return None

        readline.parse_and_bind("tab: complete")
        readline.set_completer(auto_completer)
        while True:
            try:
                command_buffer = raw_input("\nInput command : ")
                if not command_buffer:
                    continue
            except (KeyboardInterrupt, EOFError):
                print("")
                self._ctx.broker.publish(broker.TOPICS.COMMAND, "exit")
            try:
                command_buffer = shlex.split(command_buffer)
            except ValueError as e:
                print(e)
            try:
                self._ctx.broker.publish(broker.TOPICS.COMMAND,
                                         *command_buffer)
            except TypeError as e:
                print(e)