[DEV] add color in help

This commit is contained in:
Edouard DUPIN 2015-08-24 21:03:34 +02:00
parent 2604cd93be
commit aa120cde57
3 changed files with 32 additions and 10 deletions

View File

@ -47,18 +47,19 @@ localArgument = myArgs.parse()
display the help of this makefile display the help of this makefile
""" """
def usage(): def usage():
color = debug.get_color_set()
# generic argument displayed : # generic argument displayed :
myArgs.display() myArgs.display()
print(" All target can finish with '?clean' '?dump' ... ?action") print(" All target can finish with '?clean' '?dump' ... ?action")
print(" all") print(" " + color['green'] + "all" + color['default'])
print(" build all (only for the current selected board) (bynary and packages)") print(" build all (only for the current selected board) (bynary and packages)")
print(" clean") print(" " + color['green'] + "clean" + color['default'])
print(" clean all (same as previous)") print(" clean all (same as previous)")
print(" dump") print(" " + color['green'] + "dump" + color['default'])
print(" Dump all the module dependency and properties") print(" Dump all the module dependency and properties")
listOfAllModule = module.list_all_module_with_desc() listOfAllModule = module.list_all_module_with_desc()
for mod in listOfAllModule: for mod in listOfAllModule:
print(" " + mod[0]) print(" " + color['green'] + mod[0] + color['default'])
if mod[1] != "": if mod[1] != "":
print(" " + mod[1]) print(" " + mod[1])
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all") print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")

View File

@ -70,12 +70,13 @@ class ArgDefine:
return False return False
def display(self): def display(self):
color = debug.get_color_set()
if self.m_optionSmall != "" and self.m_optionBig != "": if self.m_optionSmall != "" and self.m_optionBig != "":
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig) print(" " + color['red'] + "-" + self.m_optionSmall + "" + color['default'] + " / " + color['red'] + "--" + self.m_optionBig + color['default'])
elif self.m_optionSmall != "": elif self.m_optionSmall != "":
print(" -" + self.m_optionSmall) print(" " + color['red'] + "-" + self.m_optionSmall + color['default'])
elif self.m_optionBig != "": elif self.m_optionBig != "":
print(" --" + self.m_optionBig) print(" " + color['red'] + "--" + self.m_optionBig + color['default'])
else: else:
print(" ???? ==> internal error ...") print(" ???? ==> internal error ...")
if self.m_description != "": if self.m_description != "":
@ -115,10 +116,12 @@ class ArgSection:
return "" return ""
def get_porperties(self): def get_porperties(self):
return " [" + self.m_section + "]" color = debug.get_color_set()
return " [" + color['blue'] + self.m_section + color['default'] + "]"
def display(self): def display(self):
print(" [" + self.m_section + "] : " + self.m_description) color = debug.get_color_set()
print(" [" + color['blue'] + self.m_section + color['default'] + "] : " + self.m_description)
def parse(self, argList, currentID): def parse(self, argList, currentID):
return currentID; return currentID;

View File

@ -139,3 +139,21 @@ def print_compilator(myString):
debugLock.acquire() debugLock.acquire()
print(myString) print(myString)
debugLock.release() debugLock.release()
def get_color_set() :
global color_default
global color_red
global color_green
global color_yellow
global color_blue
global color_purple
global color_cyan
return {
"default": color_default,
"red": color_red,
"green": color_green,
"yellow": color_yellow,
"blue": color_blue,
"purple": color_purple,
"cyan": color_cyan,
}