@@ -773,13 +773,14 @@ def _(event):
773773 prompt = f"{ ANSI_INVERT } "
774774
775775 if print_name or contact is None :
776- prompt = prompt + f"{ ANSI_BGRAY } "
776+ if color :
777+ prompt = prompt + f"{ ANSI_BGRAY } "
777778 prompt = prompt + f"{ mc .self_info ['name' ]} "
778779 if contact is None : # display scope
779780 if not scope is None :
780781 prompt = prompt + f"|{ scope } "
781782 if classic :
782- prompt = prompt + " > "
783+ prompt = prompt + "> "
783784 else :
784785 prompt = prompt + f"{ ANSI_NORMAL } { ARROW_HEAD } { ANSI_INVERT } "
785786
@@ -817,7 +818,7 @@ def _(event):
817818 prompt = prompt + "|" + contact ["out_path" ]
818819
819820 if classic :
820- prompt = prompt + f"{ ANSI_NORMAL } > "
821+ prompt = prompt + f"{ ANSI_NORMAL } > "
821822 else :
822823 prompt = prompt + f"{ ANSI_NORMAL } { ARROW_HEAD } "
823824
@@ -2340,26 +2341,29 @@ async def next_cmd(mc, cmds, json_output=False):
23402341 if json_output :
23412342 print (json .dumps (ev .payload , indent = 2 ))
23422343 else :
2343- classic = interactive_loop .classic or not process_event_message .color
2344+ color = process_event_message .color
2345+ classic = interactive_loop .classic or not color
23442346 print ("]" ,end = "" )
23452347 for t in ev .payload ["path" ]:
23462348 if classic :
23472349 print ("→" ,end = "" )
23482350 else :
23492351 print (f" { ANSI_INVERT } " , end = "" )
23502352 snr = t ['snr' ]
2351- if snr >= 10 :
2352- print (ANSI_BGREEN , end = "" )
2353- elif snr <= 0 :
2354- print (ANSI_BRED , end = "" )
2355- else :
2356- print (ANSI_BGRAY , end = "" )
2353+ if color :
2354+ if snr >= 10 :
2355+ print (ANSI_BGREEN , end = "" )
2356+ elif snr <= 0 :
2357+ print (ANSI_BRED , end = "" )
2358+ else :
2359+ print (ANSI_BGRAY , end = "" )
23572360 print (f"{ snr :.2f} " ,end = "" )
23582361 if classic :
23592362 print ("→" ,end = "" )
23602363 else :
23612364 print (f"{ ANSI_NORMAL } { ARROW_HEAD } " ,end = "" )
2362- print (ANSI_END , end = "" )
2365+ if color :
2366+ print (ANSI_END , end = "" )
23632367 if "hash" in t :
23642368 print (f"[{ t ['hash' ]} ]" ,end = "" )
23652369 else :
@@ -3143,6 +3147,7 @@ def usage () :
31433147 -D : debug
31443148 -S : scan for devices and show a selector
31453149 -l : list available ble/serial devices and exit
3150+ -c <on/off> : disables most of color output if off
31463151 -T <timeout> : timeout for the ble scan (-S and -l) default 2s
31473152 -a <address> : specifies device address (can be a name)
31483153 -d <name> : filter meshcore devices with name or address
@@ -3210,9 +3215,12 @@ async def main(argv):
32103215 with open (MCCLI_ADDRESS , encoding = "utf-8" ) as f :
32113216 address = f .readline ().strip ()
32123217
3213- opts , args = getopt .getopt (argv , "a:d:s:ht:p:b:fjDhvSlT:P " )
3218+ opts , args = getopt .getopt (argv , "a:d:s:ht:p:b:fjDhvSlT:Pc: " )
32143219 for opt , arg in opts :
32153220 match opt :
3221+ case "-c" :
3222+ if arg == "off" :
3223+ process_event_message .color = False
32163224 case "-d" : # name specified on cmdline
32173225 address = arg
32183226 case "-a" : # address specified on cmdline
0 commit comments