4444ANSI_BLUE = "\033 [0;34m"
4545ANSI_BBLUE = "\033 [1;34m"
4646ANSI_YELLOW = "\033 [0;33m"
47+ ANSI_BYELLOW = "\033 [1;33m"
4748ANSI_RED = "\033 [0;31m"
4849ANSI_BRED = "\033 [1;31m"
4950ANSI_MAGENTA = "\033 [0;35m"
5354ANSI_LIGHT_BLUE = "\033 [0;94m"
5455ANSI_LIGHT_GREEN = "\033 [0;92m"
5556ANSI_LIGHT_YELLOW = "\033 [0;93m"
56- ANSI_LIGHT_GRAY = "\033 [0;90m"
57+ ANSI_LIGHT_GRAY = "\033 [0;38;5;247m"
58+ ANSI_BGRAY = "\033 [1;38;5;247m"
5759
5860def escape_ansi (line ):
5961 ansi_escape = re .compile (r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]' )
@@ -193,10 +195,11 @@ def make_completion_dict(contacts):
193195 "print_snr" : {"on" :None , "off" : None },
194196 "json_msgs" : {"on" :None , "off" : None },
195197 "color" : {"on" :None , "off" :None },
198+ "print_name" : {"on" :None , "off" :None },
196199 "classic_prompt" : {"on" : None , "off" :None }},
197200 "get" : {"name" : None , "bat" : None , "coords" : None , "radio" : None ,
198201 "tx" : None , "print_snr" : None , "json_msgs" :None , "color" :None ,
199- "classic_prompt" :None },
202+ "print_name" : None , " classic_prompt" :None },
200203 "reboot" : None ,
201204 "card" : None ,
202205 "upload_card" : None ,
@@ -281,11 +284,22 @@ def _(event):
281284 while True :
282285 color = process_event_message .color
283286 classic = interactive_loop .classic or not color
287+ print_name = interactive_loop .print_name
284288
285289 if classic :
286290 prompt = ""
287291 else :
288292 prompt = f"{ ANSI_INVERT } "
293+
294+ # some possible symbols for prompts 🭬🬛🬗🭬🬛🬃🬗🭬🬛🬃🬗🬏🭀🭋🭨🮋
295+ if print_name :
296+ prompt = prompt + f"{ ANSI_BGRAY } "
297+ prompt = prompt + f"{ mc .self_info ['name' ]} "
298+ if classic :
299+ prompt = prompt + " > "
300+ else :
301+ prompt = prompt + "🭨"
302+
289303 if not last_ack :
290304 prompt = prompt + f"{ ANSI_BRED } "
291305 if classic :
@@ -298,9 +312,12 @@ def _(event):
298312 prompt = prompt + f"{ ANSI_BGREEN } "
299313 else :
300314 prompt = prompt + f"{ ANSI_BBLUE } "
301- # some possible symbols 🭬🬛🬗🭬🬛🬃🬗🭬🬛🬃🬗🬏🭀🭋🭨🮋
302315 if not classic :
303316 prompt = prompt + f"{ ANSI_INVERT } "
317+
318+ if print_name and not classic :
319+ prompt = prompt + "🭬"
320+
304321 prompt = prompt + f"{ contact ['adv_name' ]} "
305322 if classic :
306323 prompt = prompt + f"{ ANSI_NORMAL } > "
@@ -452,7 +469,7 @@ def _(event):
452469 await process_cmds (mc , ["chan" , str (contact ["chan_nb" ]), line ] )
453470
454471 elif contact ["type" ] == 1 : # chat, send to recipient and wait ack
455- await msg_ack (mc , contact , line )
472+ last_ack = await msg_ack (mc , contact , line )
456473
457474 elif contact ["type" ] == 2 or contact ["type" ] == 3 : # repeater, send cmd
458475 await process_cmds (mc , ["cmd" , contact ["adv_name" ], line ])
@@ -464,6 +481,7 @@ def _(event):
464481 # Handle task cancellation from KeyboardInterrupt in asyncio.run()
465482 print ("Exiting cli" )
466483interactive_loop .classic = False
484+ interactive_loop .print_name = True
467485
468486async def msg_ack (mc , contact , msg ) :
469487 result = await mc .commands .send_msg (contact , msg )
@@ -577,6 +595,8 @@ async def next_cmd(mc, cmds, json_output=False):
577595 lon <lon> : longitude
578596 coords <lat,lon> : coordinates
579597 print_snr <on/off> : toggle snr display in messages""" )
598+ case "print_name" :
599+ interactive_loop .print_name = (cmds [2 ] == "on" )
580600 case "classic_prompt" :
581601 interactive_loop .classic = (cmds [2 ] == "on" )
582602 case "color" :
@@ -685,6 +705,11 @@ async def next_cmd(mc, cmds, json_output=False):
685705 radio : radio parameters
686706 tx : tx power
687707 print_snr : snr display in messages""" )
708+ case "print_name" :
709+ if json_output :
710+ print (json .dumps ({"print_name" : interactive_loop .print_name }))
711+ else :
712+ print (f"{ 'on' if interactive_loop .print_name else 'off' } " )
688713 case "classic_prompt" :
689714 if json_output :
690715 print (json .dumps ({"classic_prompt" : interactive_loop .classic }))
0 commit comments