fix setperm (hex by default for argument)

This commit is contained in:
Florent 2025-08-27 22:12:25 +02:00
parent f1f5b114c0
commit 0b463d2627
2 changed files with 10 additions and 4 deletions

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "meshcore-cli" name = "meshcore-cli"
version = "1.1.15" version = "1.1.16"
authors = [ authors = [
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, { name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
] ]
@ -17,7 +17,7 @@ classifiers = [
] ]
license = "MIT" license = "MIT"
license-files = ["LICEN[CS]E*"] license-files = ["LICEN[CS]E*"]
dependencies = [ "meshcore >= 2.1.2", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ] dependencies = [ "meshcore >= 2.1.3", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0" ]
[project.urls] [project.urls]
Homepage = "https://github.com/fdlamotte/meshcore-cli" Homepage = "https://github.com/fdlamotte/meshcore-cli"

View file

@ -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.15" VERSION = "v1.1.16"
# 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/"
@ -733,7 +733,13 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
cmds = shlex.split(line) cmds = shlex.split(line)
off = 1 if line.startswith("set perm") else 0 off = 1 if line.startswith("set perm") else 0
name = cmds[1 + off] name = cmds[1 + off]
perm = int(cmds[2 + off],0) perm_string = cmds[2 + off]
if (perm_string.startswith("0x")):
perm = int(perm_string,0)
elif (perm_string.startswith("#")):
perm = int(perm_string[1:])
else:
perm = int(perm_string,16)
ct=mc.get_contact_by_name(name) ct=mc.get_contact_by_name(name)
if ct is None: if ct is None:
ct=mc.get_contact_by_key_prefix(name) ct=mc.get_contact_by_key_prefix(name)