mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
handle multiline msg
This commit is contained in:
parent
49ee83b94d
commit
f4671ff790
2 changed files with 13 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "meshcore-cli"
|
name = "meshcore-cli"
|
||||||
version = "1.1.36"
|
version = "1.1.37"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ from prompt_toolkit.shortcuts import radiolist_dialog
|
||||||
from meshcore import MeshCore, EventType, logger
|
from meshcore import MeshCore, EventType, logger
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
VERSION = "v1.1.36"
|
VERSION = "v1.1.37"
|
||||||
|
|
||||||
# default ble address is stored in a config file
|
# default ble address is stored in a config file
|
||||||
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
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-?]*[ -/]*[@-~]')
|
ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]')
|
||||||
return ansi_escape.sub('', line)
|
return ansi_escape.sub('', line)
|
||||||
|
|
||||||
def print_above(str):
|
def print_one_line_above(str):
|
||||||
""" prints a string above current line """
|
""" prints a string above current line """
|
||||||
width = os.get_terminal_size().columns
|
width = os.get_terminal_size().columns
|
||||||
stringlen = len(escape_ansi(str))-1
|
stringlen = len(escape_ansi(str))-1
|
||||||
|
|
@ -85,6 +85,11 @@ def print_above(str):
|
||||||
print(str, end="") # Print output status msg
|
print(str, end="") # Print output status msg
|
||||||
print("\u001B[u", end="", flush=True) # Jump back to saved cursor position
|
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):
|
async def process_event_message(mc, ev, json_output, end="\n", above=False):
|
||||||
""" display incoming message """
|
""" display incoming message """
|
||||||
if ev is None :
|
if ev is None :
|
||||||
|
|
@ -350,6 +355,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
||||||
"share_contact" : contact_list,
|
"share_contact" : contact_list,
|
||||||
"path": contact_list,
|
"path": contact_list,
|
||||||
"disc_path" : contact_list,
|
"disc_path" : contact_list,
|
||||||
|
"trace" : None,
|
||||||
"reset_path" : contact_list,
|
"reset_path" : contact_list,
|
||||||
"change_path" : contact_list,
|
"change_path" : contact_list,
|
||||||
"change_flags" : contact_list,
|
"change_flags" : contact_list,
|
||||||
|
|
@ -2399,6 +2405,7 @@ def command_help():
|
||||||
import_contact <URI> : import a contact from its URI ic
|
import_contact <URI> : import a contact from its URI ic
|
||||||
remove_contact <ct> : removes a contact from this node
|
remove_contact <ct> : removes a contact from this node
|
||||||
path <ct> : diplays path for a contact
|
path <ct> : diplays path for a contact
|
||||||
|
disc_path <ct> : discover new path and display dp
|
||||||
reset_path <ct> : resets path to a contact to flood rp
|
reset_path <ct> : resets path to a contact to flood rp
|
||||||
change_path <ct> <pth> : change the path to a contact cp
|
change_path <ct> <pth> : change the path to a contact cp
|
||||||
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
||||||
|
|
@ -2407,13 +2414,14 @@ def command_help():
|
||||||
req_acl <ct> : requests access control list for sensor
|
req_acl <ct> : requests access control list for sensor
|
||||||
pending_contacts : show pending contacts
|
pending_contacts : show pending contacts
|
||||||
add_pending <key> : manually add pending contact from key
|
add_pending <key> : manually add pending contact from key
|
||||||
flush_pending : flush pending contact clist
|
flush_pending : flush pending contact list
|
||||||
Repeaters
|
Repeaters
|
||||||
login <name> <pwd> : log into a node (rep) with given pwd l
|
login <name> <pwd> : log into a node (rep) with given pwd l
|
||||||
logout <name> : log out of a repeater
|
logout <name> : log out of a repeater
|
||||||
cmd <name> <cmd> : sends a command to a repeater (no ack) c [
|
cmd <name> <cmd> : sends a command to a repeater (no ack) c [
|
||||||
wmt8 : wait for a msg (reply) with a timeout ]
|
wmt8 : wait for a msg (reply) with a timeout ]
|
||||||
req_status <name> : requests status from a node rs""")
|
req_status <name> : requests status from a node rs
|
||||||
|
trace <path> : run a trace, path is comma separated""")
|
||||||
|
|
||||||
def usage () :
|
def usage () :
|
||||||
""" Prints some help """
|
""" Prints some help """
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue