mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
implement change_flags on contact
This commit is contained in:
parent
a55147898c
commit
113526d1bf
3 changed files with 29 additions and 4 deletions
|
|
@ -66,7 +66,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|||
Messenging
|
||||
msg <name> <msg> : send message to node by name m {
|
||||
wait_ack : wait an ack wa }
|
||||
chan <nb> <msg> : send message to channel number <nb> ch
|
||||
chan <nb> <msg> : send message to channel number <nb> ch
|
||||
public <msg> : send message to public channel (0) dch
|
||||
recv : reads next msg r
|
||||
wait_msg : wait for a message and read it wm
|
||||
|
|
@ -85,9 +85,12 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|||
contacts / list : gets contact list lc
|
||||
share_contact <ct> : share a contact with others sc
|
||||
export_contact <ct> : get a contact's URI ec
|
||||
import_contact <URI> : import a contactt from its URI ic
|
||||
remove_contact <ct> : removes a contact from this node
|
||||
reset_path <ct> : resets path to a contact to flood rp
|
||||
change_path <ct> <pth> : change the path to a contact cp
|
||||
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
||||
req_telemetry <ct> : prints telemetry data as json rt
|
||||
Repeaters
|
||||
login <name> <pwd> : log into a node (rep) with given pwd l
|
||||
logout <name> : log out of a repeater
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||
|
||||
[project]
|
||||
name = "meshcore-cli"
|
||||
version = "1.0.0.rc2"
|
||||
version = "0.8.2"
|
||||
authors = [
|
||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||
]
|
||||
|
|
@ -17,7 +17,7 @@ classifiers = [
|
|||
]
|
||||
license = "MIT"
|
||||
license-files = ["LICEN[CS]E*"]
|
||||
dependencies = [ "meshcore >= 1.9.8.dev6", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
|
||||
dependencies = [ "meshcore >= 1.9.8", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/fdlamotte/meshcore-cli"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from meshcore import TCPConnection, BLEConnection, SerialConnection
|
|||
from meshcore import MeshCore, EventType, logger
|
||||
|
||||
# Version
|
||||
VERSION = "v1.0.0rc2"
|
||||
VERSION = "v0.8.2"
|
||||
|
||||
# default ble address is stored in a config file
|
||||
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
||||
|
|
@ -238,6 +238,7 @@ def make_completion_dict(contacts, to=None):
|
|||
"path": contact_list,
|
||||
"reset_path" : contact_list,
|
||||
"change_path" : contact_list,
|
||||
"change_flags" : contact_list,
|
||||
"remove_contact" : contact_list,
|
||||
"import_contact" : {"meshcore://":None},
|
||||
"login" : contact_list,
|
||||
|
|
@ -296,6 +297,7 @@ def make_completion_dict(contacts, to=None):
|
|||
"upload_contact" : None,
|
||||
"reset_path" : None,
|
||||
"change_path" : None,
|
||||
"change_flags" : None,
|
||||
"req_telemetry" : None,
|
||||
})
|
||||
|
||||
|
|
@ -550,6 +552,7 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
|
|||
# same but for commands with a parameter
|
||||
elif contact["type"] > 0 and (line.startswith("cmd ") or\
|
||||
line.startswith("cp ") or line.startswith("change_path ") or\
|
||||
line.startswith("cf ") or line.startswith("change_flags ") or\
|
||||
line.startswith("login ")) :
|
||||
cmds = line.split(" ", 1)
|
||||
args = [cmds[0], contact['adv_name'], cmds[1]]
|
||||
|
|
@ -1209,6 +1212,24 @@ async def next_cmd(mc, cmds, json_output=False):
|
|||
print(json.dumps(res.payload, indent=4))
|
||||
await mc.commands.get_contacts()
|
||||
|
||||
case "change_flags" | "cf":
|
||||
argnum = 2
|
||||
await mc.ensure_contacts()
|
||||
contact = mc.get_contact_by_name(cmds[1])
|
||||
if contact is None:
|
||||
if json_output :
|
||||
print(json.dumps({"error" : "contact unknown", "name" : cmds[1]}))
|
||||
else:
|
||||
print(f"Unknown contact {cmds[1]}")
|
||||
else:
|
||||
res = await mc.commands.change_contact_flags(contact, int(cmds[2]))
|
||||
logger.debug(res)
|
||||
if res.type == EventType.ERROR:
|
||||
print(f"Error setting path: {res}")
|
||||
elif json_output :
|
||||
print(json.dumps(res.payload, indent=4))
|
||||
await mc.commands.get_contacts()
|
||||
|
||||
case "reset_path" | "rp" :
|
||||
argnum = 1
|
||||
await mc.ensure_contacts()
|
||||
|
|
@ -1546,6 +1567,7 @@ def command_help():
|
|||
remove_contact <ct> : removes a contact from this node
|
||||
reset_path <ct> : resets path to a contact to flood rp
|
||||
change_path <ct> <pth> : change the path to a contact cp
|
||||
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
||||
req_telemetry <ct> : prints telemetry data as json rt
|
||||
Repeaters
|
||||
login <name> <pwd> : log into a node (rep) with given pwd l
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue