mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
import contact
This commit is contained in:
parent
1d54bbf52b
commit
c356f5121c
2 changed files with 13 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||
|
||||
[project]
|
||||
name = "meshcore-cli"
|
||||
version = "0.8.0.dev4"
|
||||
version = "0.8.0.dev5"
|
||||
authors = [
|
||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||
]
|
||||
|
|
@ -17,7 +17,7 @@ classifiers = [
|
|||
]
|
||||
license = "MIT"
|
||||
license-files = ["LICEN[CS]E*"]
|
||||
dependencies = [ "meshcore >= 1.9.8.dev3", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
|
||||
dependencies = [ "meshcore >= 1.9.8.dev5", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/fdlamotte/meshcore-cli"
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@ def make_completion_dict(contacts, to=None):
|
|||
"reset_path" : contact_list,
|
||||
"change_path" : contact_list,
|
||||
"remove_contact" : contact_list,
|
||||
"import_contact" : {"meshcore://":None},
|
||||
"login" : contact_list,
|
||||
"cmd" : contact_list,
|
||||
"req_status" : contact_list,
|
||||
|
|
@ -1240,6 +1241,16 @@ async def next_cmd(mc, cmds, json_output=False):
|
|||
else :
|
||||
print(res.payload['uri'])
|
||||
|
||||
case "import_contact"|"ic":
|
||||
argnum = 1
|
||||
if cmds[1].startswith("meshcore://") :
|
||||
res = await mc.commands.import_contact(bytes.fromhex(cmds[1][11:]))
|
||||
logger.debug(res)
|
||||
if res.type == EventType.ERROR:
|
||||
print(f"Error while importing contact: {res}")
|
||||
else:
|
||||
logger.info("Contact successfully added, refresh with lc")
|
||||
|
||||
case "upload_contact" | "uc" :
|
||||
argnum = 1
|
||||
await mc.ensure_contacts()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue