From f4671ff790a8deb3ba41b2c9f36998ef29dc83d9 Mon Sep 17 00:00:00 2001 From: Florent Date: Wed, 29 Oct 2025 09:56:51 +0100 Subject: [PATCH] handle multiline msg --- pyproject.toml | 2 +- src/meshcore_cli/meshcore_cli.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 234ad33..f1353f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.1.36" +version = "1.1.37" 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 098f860..103a279 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.36" +VERSION = "v1.1.37" # default ble address is stored in a config file MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" @@ -69,7 +69,7 @@ def escape_ansi(line): ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]') return ansi_escape.sub('', line) -def print_above(str): +def print_one_line_above(str): """ prints a string above current line """ width = os.get_terminal_size().columns stringlen = len(escape_ansi(str))-1 @@ -85,6 +85,11 @@ def print_above(str): print(str, end="") # Print output status msg print("\u001B[u", end="", flush=True) # Jump back to saved cursor position +def print_above(str): + lines = str.split('\n') + for l in lines: + print_one_line_above(l) + async def process_event_message(mc, ev, json_output, end="\n", above=False): """ display incoming message """ if ev is None : @@ -350,6 +355,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None): "share_contact" : contact_list, "path": contact_list, "disc_path" : contact_list, + "trace" : None, "reset_path" : contact_list, "change_path" : contact_list, "change_flags" : contact_list, @@ -2399,6 +2405,7 @@ def command_help(): import_contact : import a contact from its URI ic remove_contact : removes a contact from this node path : diplays path for a contact + disc_path : discover new path and display dp reset_path : resets path to a contact to flood rp change_path : change the path to a contact cp change_flags : change contact flags (tel_l|tel_a|star)cf @@ -2407,13 +2414,14 @@ def command_help(): req_acl : requests access control list for sensor pending_contacts : show pending contacts add_pending : manually add pending contact from key - flush_pending : flush pending contact clist + flush_pending : flush pending contact list Repeaters login : log into a node (rep) with given pwd l logout : log out of a repeater cmd : sends a command to a repeater (no ack) c [ wmt8 : wait for a msg (reply) with a timeout ] - req_status : requests status from a node rs""") + req_status : requests status from a node rs + trace : run a trace, path is comma separated""") def usage () : """ Prints some help """