@@ -153,12 +153,12 @@ async def process_event_message(mc, ev, json_output, end="\n", above=False):
153153async def handle_message (event ):
154154 """ Process incoming message events """
155155 await process_event_message (handle_message .mc , event ,
156- above = handle_message .above , json_output = handle_message .json_output )
156+ above = handle_message .above ,
157+ json_output = handle_message .json_output )
157158handle_message .json_output = False
158159handle_message .mc = None
159160handle_message .above = True
160161
161-
162162def make_completion_dict (contacts ):
163163 contact_list = {}
164164 it = iter (contacts .items ())
@@ -191,9 +191,11 @@ def make_completion_dict(contacts):
191191 "req_status" : None ,
192192 "time" : None ,
193193 "clock" : {"sync" : None },
194- "ec" : None ,
195- "rp" : None ,
196- "cp" : None ,
194+ "contact_info" : None ,
195+ "path" : None ,
196+ "export_contact" : None ,
197+ "reset_path" : None ,
198+ "change_path" : None ,
197199 "cli" : None ,
198200 "script" : None ,
199201 "$remove_contact" : contact_list ,
@@ -333,6 +335,8 @@ def _(event):
333335 elif line == "sc" or line == "share_contact" or \
334336 line == "ec" or line == "export_contact" or \
335337 line == "rp" or line == "reset_path" or \
338+ line == "contact_info" or line == "ci" or \
339+ line == "path" or \
336340 line == "logout" :
337341 args = [line , contact ['adv_name' ]]
338342 await process_cmds (mc , args )
@@ -795,6 +799,38 @@ async def next_cmd(mc, cmds, json_output=False):
795799 for c in res .payload .items ():
796800 print (c [1 ]["adv_name" ])
797801
802+ case "path" :
803+ argnum = 1
804+ res = await mc .ensure_contacts ()
805+ contact = mc .get_contact_by_name (cmds [1 ])
806+ if contact is None :
807+ if json_output :
808+ print (json .dumps ({"error" : "contact unknown" , "name" : cmds [1 ]}))
809+ else :
810+ print (f"Unknown contact { cmds [1 ]} " )
811+ else :
812+ res = contact ["out_path" ]
813+ if json_output :
814+ print (json .dumps ({"adv_name" : contact ["adv_name" ],
815+ "out_path" : res }))
816+ else :
817+ if (res == "" ) :
818+ print ("0 hop" )
819+ else :
820+ print (res )
821+
822+ case "contact_info" | "ci" :
823+ argnum = 1
824+ res = await mc .ensure_contacts ()
825+ contact = mc .get_contact_by_name (cmds [1 ])
826+ if contact is None :
827+ if json_output :
828+ print (json .dumps ({"error" : "contact unknown" , "name" : cmds [1 ]}))
829+ else :
830+ print (f"Unknown contact { cmds [1 ]} " )
831+ else :
832+ print (json .dumps (contact , indent = 4 ))
833+
798834 case "change_path" | "cp" :
799835 argnum = 2
800836 await mc .ensure_contacts ()
0 commit comments