Skip to content

Commit 4b94702

Browse files
committed
showing progress when fetching contacts/channels
1 parent 7cf9032 commit 4b94702

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
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.31"
7+
version = "1.1.32"
88
authors = [
99
{ name="Florent de Lamotte", email="[email protected]" },
1010
]
@@ -17,7 +17,7 @@ classifiers = [
1717
]
1818
license = "MIT"
1919
license-files = ["LICEN[CS]E*"]
20-
dependencies = [ "meshcore >= 2.1.12", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
20+
dependencies = [ "meshcore >= 2.1.13", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
2121

2222
[project.urls]
2323
Homepage = "https://github.com/fdlamotte/meshcore-cli"

src/meshcore_cli/meshcore_cli.py

Lines changed: 10 additions & 4 deletions
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.31"
26+
VERSION = "v1.1.32"
2727

2828
# default ble address is stored in a config file
2929
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
@@ -563,8 +563,8 @@ async def interactive_loop(mc, to=None) :
563563
contact = to
564564
prev_contact = None
565565

566-
await mc.ensure_contacts()
567-
await get_channels(mc)
566+
await mc.commands.get_contacts(anim=True)
567+
await get_channels(mc, anim=True)
568568
await subscribe_to_msgs(mc, above=True)
569569

570570
handle_new_contact.print_new_contacts = True
@@ -978,10 +978,13 @@ async def get_channel_by_name (mc, name):
978978

979979
return None
980980

981-
async def get_channels (mc) :
981+
async def get_channels (mc, anim=False) :
982982
if hasattr(mc, 'channels') :
983983
return mc.channels
984984

985+
if anim:
986+
print("Fetching channels ", end="", flush=True)
987+
985988
ch = 0;
986989
mc.channels = []
987990
while True:
@@ -992,6 +995,9 @@ async def get_channels (mc) :
992995
info["channel_secret"] = info["channel_secret"].hex()
993996
mc.channels.append(info)
994997
ch = ch + 1
998+
if anim:
999+
print(".", end="", flush=True)
1000+
print (" Done")
9951001
return mc.channels
9961002

9971003
async def next_cmd(mc, cmds, json_output=False):

0 commit comments

Comments
 (0)