44"""
55
66import asyncio
7- import os , sys , io
7+ import os , sys , io , platform
88import time , datetime
99import getopt , json , shlex , re
1010import logging
3333from meshcore import MeshCore , EventType , logger
3434
3535# Version
36- VERSION = "v1.2.8 "
36+ VERSION = "v1.2.10 "
3737
3838# default ble address is stored in a config file
3939MCCLI_CONFIG_DIR = str (Path .home ()) + "/.config/meshcore/"
7676ANSI_YELLOW = "\033 [0;33m"
7777ANSI_BYELLOW = "\033 [1;33m"
7878
79+ #Unicode chars
80+ # some possible symbols for prompts 🭬🬛🬗🭬🬛🬃🬗🭬🬛🬃🬗🬏🭀🭋🭨🮋
81+ ARROW_TAIL = "🭨"
82+ ARROW_HEAD = "🭬"
83+
84+ if platform .system () == 'Windows' or platform .system () == 'Darwin' :
85+ ARROW_TAIL = ""
86+ ARROW_HEAD = " "
87+
7988def escape_ansi (line ):
8089 ansi_escape = re .compile (r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]' )
8190 return ansi_escape .sub ('' , line )
@@ -762,7 +771,6 @@ def _(event):
762771 else :
763772 prompt = f"{ ANSI_INVERT } "
764773
765- # some possible symbols for prompts 🭬🬛🬗🭬🬛🬃🬗🭬🬛🬃🬗🬏🭀🭋🭨🮋
766774 if print_name or contact is None :
767775 prompt = prompt + f"{ ANSI_BGRAY } "
768776 prompt = prompt + f"{ mc .self_info ['name' ]} "
@@ -772,7 +780,7 @@ def _(event):
772780 if classic :
773781 prompt = prompt + " > "
774782 else :
775- prompt = prompt + f"{ ANSI_NORMAL } 🭬 { ANSI_INVERT } "
783+ prompt = prompt + f"{ ANSI_NORMAL } { ARROW_HEAD } { ANSI_INVERT } "
776784
777785 if not contact is None :
778786 if not last_ack :
@@ -793,7 +801,7 @@ def _(event):
793801 prompt = prompt + f"{ ANSI_INVERT } "
794802
795803 if print_name and not classic :
796- prompt = prompt + f"{ ANSI_NORMAL } 🭨 { ANSI_INVERT } "
804+ prompt = prompt + f"{ ANSI_NORMAL } { ARROW_TAIL } { ANSI_INVERT } "
797805
798806 prompt = prompt + f"{ contact ['adv_name' ]} "
799807 if contact ["type" ] == 0 or contact ["out_path_len" ]== - 1 :
@@ -810,7 +818,7 @@ def _(event):
810818 if classic :
811819 prompt = prompt + f"{ ANSI_NORMAL } > "
812820 else :
813- prompt = prompt + f"{ ANSI_NORMAL } 🭬 "
821+ prompt = prompt + f"{ ANSI_NORMAL } { ARROW_HEAD } "
814822
815823 prompt = prompt + f"{ ANSI_END } "
816824
@@ -1604,6 +1612,7 @@ async def print_disc_trace_to (mc, contact):
16041612
16051613async def next_cmd (mc , cmds , json_output = False ):
16061614 """ process next command """
1615+ global ARROW_TAIL , ARROW_HEAD
16071616 try :
16081617 argnum = 0
16091618
@@ -1737,6 +1746,10 @@ async def next_cmd(mc, cmds, json_output=False):
17371746 interactive_loop .classic = (cmds [2 ] == "on" )
17381747 if json_output :
17391748 print (json .dumps ({"cmd" : cmds [1 ], "param" : cmds [2 ]}))
1749+ case "arrow_tail" :
1750+ ARROW_TAIL = cmds [2 ]
1751+ case "arrow_head" :
1752+ ARROW_HEAD = cmds [2 ]
17401753 case "color" :
17411754 process_event_message .color = (cmds [2 ] == "on" )
17421755 if json_output :
@@ -2344,7 +2357,7 @@ async def next_cmd(mc, cmds, json_output=False):
23442357 if classic :
23452358 print ("→" ,end = "" )
23462359 else :
2347- print (f"{ ANSI_NORMAL } 🭬 " ,end = "" )
2360+ print (f"{ ANSI_NORMAL } { ARROW_HEAD } " ,end = "" )
23482361 print (ANSI_END , end = "" )
23492362 if "hash" in t :
23502363 print (f"[{ t ['hash' ]} ]" ,end = "" )
0 commit comments