Esempio n. 1
0
    def push(self, line):
        """
        Handle a command.
        """

        for l in run_command(self.commands, self.factory, line):
            printable = "%s\n" % l
            for user in self.factory.protocols:
                printable = printable.replace(user, fancy_console_name(user))
            # Have to encode to keep Unicode off the wire.
            self.handler.addOutput(printable.encode("utf8"))
Esempio n. 2
0
 def lastColorizedLine(self, line):
     s = []
     for token in line.split():
         try:
             int(token)
             s.append(typeToColor["number"] + token)
         except ValueError:
             if token in self.commands:
                 s.append(typeToColor["keyword"] + token)
             elif token in self.factory.protocols:
                 s.append(fancy_console_name(token))
             else:
                 s.append(normalColor + token)
     return normalColor + " ".join(s)
Esempio n. 3
0
 def lastColorizedLine(self, line):
     s = []
     for token in line.split():
         try:
             int(token)
             s.append(typeToColor["number"] + token)
         except ValueError:
             if token in self.commands:
                 s.append(typeToColor["keyword"] + token)
             elif token in self.factory.protocols:
                 s.append(fancy_console_name(token))
             else:
                 s.append(normalColor + token)
     return normalColor + " ".join(s)