From f8fbec0ebe6210939a15f5f4b771abd73ada716f Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 16 Oct 2025 09:14:33 +0200 Subject: [PATCH] add reload_contacts command and show contacts count --- pyproject.toml | 2 +- src/meshcore_cli/meshcore_cli.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index dfcceab..d33c012 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.1.26" +version = "1.1.27" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index d8e1da9..b87dc15 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -23,7 +23,7 @@ from prompt_toolkit.shortcuts import radiolist_dialog from meshcore import MeshCore, EventType, logger # Version -VERSION = "v1.1.26" +VERSION = "v1.1.27" # default ble address is stored in a config file MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" @@ -355,6 +355,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None): "change_flags" : contact_list, "remove_contact" : contact_list, "import_contact" : {"meshcore://":None}, + "reload_contacts" : None, "login" : contact_list, "cmd" : contact_list, "req_status" : contact_list, @@ -1827,6 +1828,17 @@ async def next_cmd(mc, cmds, json_output=False): else : for c in res.items(): print(c[1]["adv_name"]) + print(f"> {len(mc.contacts)} contacts in device") + + case "reload_contacts" | "rc": + await mc.commands.get_contacts() + res = mc.contacts + if json_output : + print(json.dumps(res, indent=4)) + else : + for c in res.items(): + print(c[1]["adv_name"]) + print(f"> {len(mc.contacts)} contacts in device") case "pending_contacts": if json_output: @@ -2245,6 +2257,7 @@ def command_help(): clock sync : sync device clock st Contacts contacts / list : gets contact list lc + reload_contacts : force reloading all contacts rc contact_info : prints information for contact ct ci contact_timeout v : sets temp default timeout for contact share_contact : share a contact with others sc