def P(self, content, sep=False): if isinstance(content, bytes): content = content.decode() if self._opt("highlight"): hl = self._opt("highlight") hl = hl if isinstance(hl, list) else [hl] for h in hl: if content.find(h) > -1: if not re.findall("33\/.*{0}.*33\/".format(h), content): content = content.replace( h, Printer.Highlighter(h, "yellow")) print("{0}{1}{0}".format("\n" if sep else "", content))
def Intro(self, source, log_cnt, prnt=False): x = "\n".join([ Printer.Highlighter(("<" * 55) + " belch CLI " + (">" * 55), "orange"), "Source: {0}".format(source), "Records: {0}".format(log_cnt), "" ]) if not prnt: return x else: self.P(x)
def GetPrompt(self): return Printer.Highlighter("b3l(h> ", "orange")
def Warring(self, mesage): self.P(Printer.Highlighter(message, "yellow"))
def Error(self, message): self.P(Printer.Highlighter(message, "red"))
def Success(self, message): self.P(Printer.Highlighter(message, "green"))