mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
if command is a contact name, launch a chat to that contact
This commit is contained in:
parent
aa45036f15
commit
5dabe7adf1
1 changed files with 8 additions and 2 deletions
|
|
@ -835,7 +835,13 @@ async def next_cmd(mc, cmds, json_output=False):
|
|||
print(f"{res.payload['response']}")
|
||||
|
||||
else :
|
||||
logger.error(f"Unknown command : {cmd}")
|
||||
await mc.ensure_contacts()
|
||||
contact = mc.get_contact_by_name(cmds[0])
|
||||
if contact is None:
|
||||
logger.error(f"Unknown command : {cmd}, will exit ...")
|
||||
return None
|
||||
|
||||
await interactive_loop(mc, to=contact)
|
||||
|
||||
logger.debug(f"cmd {cmds[0:argnum+1]} processed ...")
|
||||
return cmds[argnum+1:]
|
||||
|
|
@ -845,7 +851,7 @@ async def process_cmds (mc, args, json_output=False) :
|
|||
first = True
|
||||
if json_output :
|
||||
print("[")
|
||||
while len(cmds) > 0 :
|
||||
while cmds and len(cmds) > 0 :
|
||||
if not first and json_output :
|
||||
print(",")
|
||||
cmds = await next_cmd(MC, cmds, json_output)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue