Skip to content

Commit f8fbec0

Browse files
committed
add reload_contacts command and show contacts count
1 parent 875f5a7 commit f8fbec0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "meshcore-cli"
7-
version = "1.1.26"
7+
version = "1.1.27"
88
authors = [
99
{ name="Florent de Lamotte", email="[email protected]" },
1010
]

src/meshcore_cli/meshcore_cli.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from meshcore import MeshCore, EventType, logger
2424

2525
# Version
26-
VERSION = "v1.1.26"
26+
VERSION = "v1.1.27"
2727

2828
# default ble address is stored in a config file
2929
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
@@ -355,6 +355,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
355355
"change_flags" : contact_list,
356356
"remove_contact" : contact_list,
357357
"import_contact" : {"meshcore://":None},
358+
"reload_contacts" : None,
358359
"login" : contact_list,
359360
"cmd" : contact_list,
360361
"req_status" : contact_list,
@@ -1827,6 +1828,17 @@ async def next_cmd(mc, cmds, json_output=False):
18271828
else :
18281829
for c in res.items():
18291830
print(c[1]["adv_name"])
1831+
print(f"> {len(mc.contacts)} contacts in device")
1832+
1833+
case "reload_contacts" | "rc":
1834+
await mc.commands.get_contacts()
1835+
res = mc.contacts
1836+
if json_output :
1837+
print(json.dumps(res, indent=4))
1838+
else :
1839+
for c in res.items():
1840+
print(c[1]["adv_name"])
1841+
print(f"> {len(mc.contacts)} contacts in device")
18301842

18311843
case "pending_contacts":
18321844
if json_output:
@@ -2245,6 +2257,7 @@ def command_help():
22452257
clock sync : sync device clock st
22462258
Contacts
22472259
contacts / list : gets contact list lc
2260+
reload_contacts : force reloading all contacts rc
22482261
contact_info <ct> : prints information for contact ct ci
22492262
contact_timeout <ct> v : sets temp default timeout for contact
22502263
share_contact <ct> : share a contact with others sc

0 commit comments

Comments
 (0)