示例#1
0
def run(process, std="nothing"):
    print(c.bold("a"))
    print(c.bold(c.green("a")))
    print(c.green("a"))
    print(c.bold(c.red("a")))
    print(c.red("a"))
    print(c.bold(c.blue("a")))
    print(c.blue("a"))
    print(c.bold(c.yellow("a")))
    print(c.yellow("a"))
    return "a"
示例#2
0
def helplist(dictionary, max_length=20, color="green"):
    # the dictionary to be converted into the list
    dict = dictionary

    # the actual string of the list
    string = "\n"
    for name in dict.keys():
        temp_string = ""
        # adding the name of the function as bold and colored as one of the rgb colors passed
        if color == "green":
            temp_string += colors.bold(colors.green(" "+name))
        elif color == "red":
            temp_string += colors.bold(colors.red(" "+name))
        elif color == "blue":
            temp_string += colors.bold(colors.blue(" "+name))
        # adding the amount of whitespaces missing until the max character count has been reached
        for i in range(0, max_length - len(name), 1):
            temp_string += " "
        # adding the separation
        temp_string += " - "
        # adding the content of the description to the string
        temp_string += dict[name]
        count = 0
        for character in temp_string:
            string += character
            if count == get_terminal_width() + 15:
                string += "\n" + (" " * (max_length+4))
                count = 0
            if len(str(character)) == 1:
                count += 1
        if string[-1] != "\n":
            string += "\n"
    return string
示例#3
0
 def __init__(self, string):
     self.type = ""
     self.string = string.replace("\\r\\n", "\n")
     self.message = ""
     # creating the message string with the colors and symbols according
     if self.string[0:3] == "[!]":
         self.message = colors.red(str(self.string))
         self.type = "error"
     elif self.string[0:3] == "[*]":
         self.message = colors.white(str(self.string))
         self.type = "process"
     elif self.string[0:3] == "[+]":
         self.message = colors.green(str(self.string))
         self.type = "result"
示例#4
0
 def __init__(self, typ, string):
     # creating the class variables
     self.type = typ
     self.string = string
     self.message = ""
     # creating the message string with the colors and symbols according
     if typ == "warning":
         self.message = colors.yellow("[!] " + str(self.string))
     elif typ == "error":
         self.message = colors.red("[!] " + str(self.string))
     elif typ == "process":
         self.message = colors.white("[*] " + str(self.string))
     elif typ == "result":
         self.message = colors.green("[+] " + str(self.string))
     elif typ == "output":
         self.message = colors.white(str(self.string))