Add --nocolor option to forcibly disable output coloring
This commit is contained in:
parent
3ccc0d4603
commit
2b1f09a032
|
|
@ -103,7 +103,7 @@ def parseopts(args):
|
|||
global VERSION,COMPRESSOR,THREADCOUNT,OSXTARGET
|
||||
longopts = [
|
||||
"help","distributor=","verbose","runtime","osxtarget=",
|
||||
"optimize=","everything","nothing","installer","rtdist",
|
||||
"optimize=","everything","nothing","installer","rtdist","nocolor",
|
||||
"version=","lzma","no-python","threads=","outputdir=","override="]
|
||||
anything = 0
|
||||
optimize = ""
|
||||
|
|
@ -125,6 +125,7 @@ def parseopts(args):
|
|||
elif (option=="--threads"): THREADCOUNT=int(value)
|
||||
elif (option=="--outputdir"): SetOutputDir(value.strip())
|
||||
elif (option=="--osxtarget"): OSXTARGET=value.strip()
|
||||
elif (option=="--nocolor"): DisableColors()
|
||||
elif (option=="--version"):
|
||||
VERSION=value
|
||||
if (len(VERSION.split(".")) != 3): raise "usage"
|
||||
|
|
|
|||
|
|
@ -120,6 +120,10 @@ try:
|
|||
HAVE_COLORS=sys.stdout.isatty()
|
||||
except: pass
|
||||
|
||||
def DisableColors():
|
||||
global HAVE_COLORS
|
||||
HAVE_COLORS = False
|
||||
|
||||
def GetColor(color = None):
|
||||
if not HAVE_COLORS: return ""
|
||||
if color != None: color = color.lower()
|
||||
|
|
|
|||
Loading…
Reference in New Issue