meshcore-cli 1.6.13__tar.gz → 1.6.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/PKG-INFO +5 -3
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/README.md +3 -1
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/flake.nix +3 -2
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/pyproject.toml +2 -2
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/scripts/README.md +1 -1
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/src/meshcore_cli/meshcore_cli.py +100 -20
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/.gitignore +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/LICENSE +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/flake.lock +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/scripts/getpos.py +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.13 → meshcore_cli-1.6.15}/sxmo/sxmo_mc.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.15
|
|
4
4
|
Summary: Command line interface to meshcore companion radios and repeaters
|
|
5
5
|
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
6
|
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.10
|
|
13
13
|
Requires-Dist: bleak>=0.22
|
|
14
|
-
Requires-Dist: meshcore>=2.3.
|
|
14
|
+
Requires-Dist: meshcore>=2.3.23
|
|
15
15
|
Requires-Dist: prompt-toolkit>=3.0.50
|
|
16
16
|
Requires-Dist: requests>=2.28.0
|
|
17
17
|
Requires-Dist: zeroconf>=0.131
|
|
@@ -254,11 +254,13 @@ Will print out the content of `rx_log` as it comes in.
|
|
|
254
254
|
|
|
255
255
|
#### Timers
|
|
256
256
|
|
|
257
|
-
`timer [-j] [-c<contact>] [-s<scope>] <s> <line>` runs `line` every `s` seconds.
|
|
257
|
+
`timer [-j] [-x] [-n<count>] [-c<contact>] [-s<scope>] <s> <line>` runs `line` every `s` seconds.
|
|
258
258
|
|
|
259
259
|
- `-c` sets the contact the line is run from (`~` for root).
|
|
260
260
|
- `-s` sets the scope for the line (default is the current scope of the node).
|
|
261
261
|
- `-j` forces json output for the timed line.
|
|
262
|
+
- `-x` executes the line immediately instead of waiting `s` seconds for the first run.
|
|
263
|
+
- `-n` runs the line `count` times and then disarms the timer (default: runs until cancelled). For instance `timer -x -n3 10m "chan 1 hi"` sends the message right away, then 2 more times at 10 minute intervals.
|
|
262
264
|
|
|
263
265
|
`timers` lists the running timers and `timer_cancel <n>` cancels timer `n`.
|
|
264
266
|
|
|
@@ -235,11 +235,13 @@ Will print out the content of `rx_log` as it comes in.
|
|
|
235
235
|
|
|
236
236
|
#### Timers
|
|
237
237
|
|
|
238
|
-
`timer [-j] [-c<contact>] [-s<scope>] <s> <line>` runs `line` every `s` seconds.
|
|
238
|
+
`timer [-j] [-x] [-n<count>] [-c<contact>] [-s<scope>] <s> <line>` runs `line` every `s` seconds.
|
|
239
239
|
|
|
240
240
|
- `-c` sets the contact the line is run from (`~` for root).
|
|
241
241
|
- `-s` sets the scope for the line (default is the current scope of the node).
|
|
242
242
|
- `-j` forces json output for the timed line.
|
|
243
|
+
- `-x` executes the line immediately instead of waiting `s` seconds for the first run.
|
|
244
|
+
- `-n` runs the line `count` times and then disarms the timer (default: runs until cancelled). For instance `timer -x -n3 10m "chan 1 hi"` sends the message right away, then 2 more times at 10 minute intervals.
|
|
243
245
|
|
|
244
246
|
`timers` lists the running timers and `timer_cancel <n>` cancels timer `n`.
|
|
245
247
|
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
meshcore = python3Packages.buildPythonPackage rec {
|
|
19
19
|
pname = "meshcore";
|
|
20
|
-
version = "2.3.
|
|
20
|
+
version = "2.3.23";
|
|
21
21
|
pyproject = true;
|
|
22
22
|
|
|
23
23
|
src = python3Packages.fetchPypi {
|
|
24
24
|
inherit pname version;
|
|
25
|
-
sha256 = "sha256-
|
|
25
|
+
sha256 = "sha256-cU85RRdfpK6knerJ2/a5v5aXqpgdBRchIBSMQ3Vs1jM=";
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
build-system = [ python3Packages.hatchling ];
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
python3Packages.pycayennelpp
|
|
33
33
|
python3Packages.pyserial-asyncio-fast
|
|
34
34
|
python3Packages.pycryptodome
|
|
35
|
+
python3Packages.zeroconf
|
|
35
36
|
];
|
|
36
37
|
|
|
37
38
|
pythonImportsCheck = [ "meshcore" ];
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "meshcore-cli"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.15"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
|
10
10
|
]
|
|
@@ -17,7 +17,7 @@ classifiers = [
|
|
|
17
17
|
]
|
|
18
18
|
license = "MIT"
|
|
19
19
|
license-files = ["LICEN[CS]E*"]
|
|
20
|
-
dependencies = [ "meshcore >= 2.3.
|
|
20
|
+
dependencies = [ "meshcore >= 2.3.23",
|
|
21
21
|
"bleak >= 0.22",
|
|
22
22
|
"zeroconf >= 0.131",
|
|
23
23
|
"prompt_toolkit >= 3.0.50",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Some example scripts to interact with meshcore-cli
|
|
2
2
|
|
|
3
|
-
Since version 1.
|
|
3
|
+
Since version 1.6.0 it is possible to interact with external scripts through a redirection mechanism.
|
|
4
4
|
|
|
5
5
|
Result of meshcore-cli commands can be redirected to files or processes, starting your lines with `|`, `>` or `>>`. While it is possible to inject the stdout from a command inside the meshcore-cli line using `<|`
|
|
6
6
|
|
|
@@ -16,8 +16,9 @@ import subprocess
|
|
|
16
16
|
import math
|
|
17
17
|
from prompt_toolkit.shortcuts import PromptSession
|
|
18
18
|
from prompt_toolkit.shortcuts import CompleteStyle
|
|
19
|
-
from prompt_toolkit.completion import NestedCompleter, PathCompleter
|
|
19
|
+
from prompt_toolkit.completion import NestedCompleter, PathCompleter, Completer, Completion
|
|
20
20
|
from prompt_toolkit.history import FileHistory
|
|
21
|
+
from prompt_toolkit.document import Document
|
|
21
22
|
from prompt_toolkit.formatted_text import ANSI
|
|
22
23
|
from prompt_toolkit.key_binding import KeyBindings
|
|
23
24
|
from prompt_toolkit.shortcuts import radiolist_dialog
|
|
@@ -41,7 +42,7 @@ except ImportError:
|
|
|
41
42
|
from meshcore import MeshCore, EventType, logger
|
|
42
43
|
|
|
43
44
|
# Version
|
|
44
|
-
VERSION = "v1.6.
|
|
45
|
+
VERSION = "v1.6.15"
|
|
45
46
|
|
|
46
47
|
# default ble address is stored in a config file
|
|
47
48
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
@@ -252,8 +253,12 @@ def enqueue_handler_event(handler_type, payload):
|
|
|
252
253
|
logger.warning(f"Handler {handler['id']} queue is full; dropping event")
|
|
253
254
|
|
|
254
255
|
async def run_timer(mc, timer):
|
|
256
|
+
first = timer["exec"] # -x: first run without waiting for the delay
|
|
255
257
|
while True:
|
|
256
|
-
|
|
258
|
+
if first:
|
|
259
|
+
first = False
|
|
260
|
+
else:
|
|
261
|
+
await asyncio.sleep(timer["secs"])
|
|
257
262
|
async with CMD_LOCK:
|
|
258
263
|
base = set_scope.current_scope
|
|
259
264
|
if base is None:
|
|
@@ -261,13 +266,22 @@ async def run_timer(mc, timer):
|
|
|
261
266
|
try:
|
|
262
267
|
if timer["scope"] != base:
|
|
263
268
|
await set_scope(mc, timer["scope"])
|
|
264
|
-
await process_redirected_line(mc, timer["cmd"], timer["contact"], timer["scope"], None, base, json_output=timer["json"], sink=sys.stdout)
|
|
269
|
+
await process_redirected_line(mc, timer["cmd"], timer["contact"], timer["scope"], None, base, json_output=timer["json"], sink=sys.stdout, stream=timer["stream"])
|
|
265
270
|
except Exception as e:
|
|
266
271
|
logger.error(f"Timer {timer['id']}: {e}")
|
|
267
272
|
finally:
|
|
268
273
|
if timer["scope"] != base:
|
|
269
274
|
await set_scope(mc, base)
|
|
270
275
|
|
|
276
|
+
# n given: count the run and disarm the timer once it is exhausted
|
|
277
|
+
if timer["remaining"] is not None:
|
|
278
|
+
timer["remaining"] -= 1
|
|
279
|
+
if timer["remaining"] <= 0:
|
|
280
|
+
TIMERS.pop(timer["id"], None)
|
|
281
|
+
if timer["fin"]:
|
|
282
|
+
print(f"Timer {timer['id']} finished")
|
|
283
|
+
return
|
|
284
|
+
|
|
271
285
|
async def write_handler(handler):
|
|
272
286
|
try:
|
|
273
287
|
while True:
|
|
@@ -704,12 +718,38 @@ class MyNestedCompleter(NestedCompleter):
|
|
|
704
718
|
else: # normal behavior for remainder
|
|
705
719
|
yield from super().get_completions(document, complete_event)
|
|
706
720
|
|
|
721
|
+
class OptionsCompleter(Completer):
|
|
722
|
+
def __init__(self, options, then=None):
|
|
723
|
+
self.options = list(options)
|
|
724
|
+
if isinstance(then, dict):
|
|
725
|
+
then = NestedCompleter.from_nested_dict(then)
|
|
726
|
+
self.then = then
|
|
727
|
+
|
|
728
|
+
def get_completions(self, document, complete_event):
|
|
729
|
+
words = document.text_before_cursor.split(" ")
|
|
730
|
+
current = words[-1]
|
|
731
|
+
done = [w for w in words[:-1] if w]
|
|
732
|
+
|
|
733
|
+
n = 0 # leading words that are options
|
|
734
|
+
while n < len(done) and done[n].startswith("-"):
|
|
735
|
+
n += 1
|
|
736
|
+
|
|
737
|
+
if n == len(done) and (current == "" or current.startswith("-")):
|
|
738
|
+
used = {w[:2] for w in done}
|
|
739
|
+
for o in self.options:
|
|
740
|
+
if o[:2] not in used and o.startswith(current):
|
|
741
|
+
yield Completion(o, start_position=-len(current))
|
|
742
|
+
|
|
743
|
+
if self.then is not None and not current.startswith("-"):
|
|
744
|
+
rest = " ".join(done[n:] + [current])
|
|
745
|
+
yield from self.then.get_completions(Document(rest, len(rest)), complete_event)
|
|
746
|
+
|
|
707
747
|
|
|
708
748
|
def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
709
749
|
pending = pending or {}
|
|
710
750
|
contact_list = {}
|
|
711
751
|
pending_list = {}
|
|
712
|
-
discovered_list = {
|
|
752
|
+
discovered_list = {}
|
|
713
753
|
to_list = {}
|
|
714
754
|
|
|
715
755
|
to_list["~"] = None
|
|
@@ -750,7 +790,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
750
790
|
root_completion_list = {
|
|
751
791
|
"public" : None,
|
|
752
792
|
"chan" : None,
|
|
753
|
-
"chan_data" :
|
|
793
|
+
"chan_data" : OptionsCompleter(["-p"]),
|
|
754
794
|
"ver" : None,
|
|
755
795
|
"infos" : None,
|
|
756
796
|
"advert" : None,
|
|
@@ -763,7 +803,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
763
803
|
"reboot" : None,
|
|
764
804
|
"card" : None,
|
|
765
805
|
"upload_card" : None,
|
|
766
|
-
"contacts":
|
|
806
|
+
"contacts": OptionsCompleter(["-s", "-f", "-t", "-b", "-q", "-l"]),
|
|
807
|
+
"lc": OptionsCompleter(["-s", "-f", "-t", "-b", "-q", "-l"]),
|
|
767
808
|
"pending_contacts": None,
|
|
768
809
|
"add_pending": pending_list,
|
|
769
810
|
"flush_pending": None,
|
|
@@ -774,9 +815,9 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
774
815
|
"path": contact_list,
|
|
775
816
|
"disc_path" : contact_list,
|
|
776
817
|
"advert_path" : contact_list | pending_list,
|
|
777
|
-
"node_discover":
|
|
818
|
+
"node_discover": OptionsCompleter(["-f", "-tall", "-tsens", "-trep", "-tcomp", "-troom", "-tcli"]),
|
|
778
819
|
"list_discovered": None,
|
|
779
|
-
"add_discovered": discovered_list,
|
|
820
|
+
"add_discovered": OptionsCompleter(["-a", "-n"], then=discovered_list),
|
|
780
821
|
"trace" : None,
|
|
781
822
|
"reset_path" : contact_list,
|
|
782
823
|
"change_path" : contact_list,
|
|
@@ -792,7 +833,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
792
833
|
"handler_attach": {"rxlog":None, "msgs":None, "chan_data":None, "telemetry":None},
|
|
793
834
|
"handler_detach": None,
|
|
794
835
|
"handlers": None,
|
|
795
|
-
"timer":
|
|
836
|
+
"timer": OptionsCompleter(["-j", "-x", "-n", "-c", "-s", "-u", "-f"]),
|
|
796
837
|
"timer_cancel": None,
|
|
797
838
|
"timers": None,
|
|
798
839
|
"login" : contact_list,
|
|
@@ -999,7 +1040,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
999
1040
|
"unsub_telemetry" : None,
|
|
1000
1041
|
"req_binary" : None,
|
|
1001
1042
|
"forget_password" : None,
|
|
1002
|
-
"timer" :
|
|
1043
|
+
"timer" : OptionsCompleter(["-j", "-x", "-n", "-s", "-u", "-f"]),
|
|
1003
1044
|
}
|
|
1004
1045
|
|
|
1005
1046
|
client_completion_list = dict(contact_completion_list)
|
|
@@ -1362,8 +1403,8 @@ if platform.system() == "Darwin" or platform.system() == "Windows":
|
|
|
1362
1403
|
else:
|
|
1363
1404
|
interactive_loop.classic = False
|
|
1364
1405
|
|
|
1365
|
-
async def process_redirected_line(mc, line, contact=None, scope="*", prev_contact=None, prev_scope="*", json_output=False, sink=sys.stdout, end="\n"):
|
|
1366
|
-
if line.startswith("@") and
|
|
1406
|
+
async def process_redirected_line(mc, line, contact=None, scope="*", prev_contact=None, prev_scope="*", json_output=False, sink=sys.stdout, end="\n", stream=True):
|
|
1407
|
+
if line.startswith("@") and line[1:2].isalnum(): # alias => replace and resolve parameters
|
|
1367
1408
|
try:
|
|
1368
1409
|
args = shlex.split(line[1:])
|
|
1369
1410
|
alias = ALIASES[args[0]]
|
|
@@ -1416,8 +1457,11 @@ async def process_redirected_line(mc, line, contact=None, scope="*", prev_contac
|
|
|
1416
1457
|
line = line[1:].strip()
|
|
1417
1458
|
try:
|
|
1418
1459
|
pcom, mcline = split_first_token(line)
|
|
1419
|
-
with subprocess.Popen(shlex.split(pcom, posix=True), stdin=subprocess.PIPE, stdout=sink,text=True) as process:
|
|
1460
|
+
with subprocess.Popen(shlex.split(pcom, posix=True), stdin=subprocess.PIPE, stdout=sink if stream else subprocess.PIPE, text=True) as process:
|
|
1420
1461
|
(new_contact, new_scope, last_ack) = await process_redirected_line(mc, mcline, contact, scope, prev_contact, prev_scope, json_output=json_output, sink=process.stdin)
|
|
1462
|
+
if not stream:
|
|
1463
|
+
process.stdin.close()
|
|
1464
|
+
sink.write(process.stdout.read())
|
|
1421
1465
|
except ValueError:
|
|
1422
1466
|
logger.error("Couldn't parse name")
|
|
1423
1467
|
except FileNotFoundError:
|
|
@@ -4543,6 +4587,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4543
4587
|
argnum = 2
|
|
4544
4588
|
if cmds[2] == "":
|
|
4545
4589
|
ALIASES.pop(cmds[1], None)
|
|
4590
|
+
elif not cmds[1][:1].isalnum():
|
|
4591
|
+
logger.error("Alias key must start with a letter or digit")
|
|
4546
4592
|
else:
|
|
4547
4593
|
ALIASES[cmds[1]] = cmds[2]
|
|
4548
4594
|
elif len(cmds) > 1: # get value if exists
|
|
@@ -4658,18 +4704,32 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4658
4704
|
output_str += json.dumps(HANDLERS, default=str)+end
|
|
4659
4705
|
|
|
4660
4706
|
case "timer":
|
|
4661
|
-
argnum = 2 # [-j] [-c<contact>] [-s<scope>] secs line
|
|
4707
|
+
argnum = 2 # [-j] [-x] [-n<count>] [-c<contact>] [-s<scope>] [-u] [-f] secs line
|
|
4662
4708
|
t_contact = None
|
|
4663
4709
|
t_scope = set_scope.current_scope
|
|
4664
4710
|
if t_scope is None:
|
|
4665
4711
|
t_scope = ""
|
|
4666
4712
|
t_json = json_output
|
|
4713
|
+
t_count = None # None = runs until cancelled
|
|
4714
|
+
t_exec = False # -x : first run without delay
|
|
4715
|
+
t_stream = False # -u : unbuffered, pipe output goes under the prompt
|
|
4716
|
+
t_fin = False # -f : tell when the timer has finished (with -n)
|
|
4667
4717
|
valid = True
|
|
4668
4718
|
|
|
4669
4719
|
args = cmds[1:]
|
|
4670
4720
|
while len(args) > 0 and args[0][0] == "-":
|
|
4671
4721
|
argnum += 1
|
|
4672
4722
|
|
|
4723
|
+
if args[0].startswith("-x"): # exec now, then every s seconds
|
|
4724
|
+
t_exec = True
|
|
4725
|
+
|
|
4726
|
+
if args[0].startswith("-n"): # number of runs before disarming
|
|
4727
|
+
if args[0][2:].isdigit() and int(args[0][2:]) > 0:
|
|
4728
|
+
t_count = int(args[0][2:])
|
|
4729
|
+
else:
|
|
4730
|
+
valid = False
|
|
4731
|
+
logger.error(f"Invalid count {args[0][2:]!r} for -n, expected a positive integer")
|
|
4732
|
+
|
|
4673
4733
|
if args[0].startswith("-j"): # force json output for the timer
|
|
4674
4734
|
t_json = True
|
|
4675
4735
|
|
|
@@ -4699,6 +4759,12 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4699
4759
|
"type": 0,
|
|
4700
4760
|
"chan_nb": chan["channel_idx"],}
|
|
4701
4761
|
|
|
4762
|
+
if args[0].startswith("-u"): # unbuffered: streaming
|
|
4763
|
+
t_stream = True
|
|
4764
|
+
|
|
4765
|
+
if args[0].startswith("-f"): # inform when the timer finishes
|
|
4766
|
+
t_fin = True
|
|
4767
|
+
|
|
4702
4768
|
if args[0].startswith("-s"): # scope
|
|
4703
4769
|
t_scope = args[0][2:]
|
|
4704
4770
|
|
|
@@ -4713,6 +4779,11 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4713
4779
|
timer["scope"] = t_scope
|
|
4714
4780
|
timer["contact"] = t_contact
|
|
4715
4781
|
timer["json"] = t_json
|
|
4782
|
+
timer["exec"] = t_exec
|
|
4783
|
+
timer["stream"] = t_stream
|
|
4784
|
+
timer["fin"] = t_fin
|
|
4785
|
+
timer["count"] = t_count
|
|
4786
|
+
timer["remaining"] = t_count
|
|
4716
4787
|
timer["task"] = asyncio.create_task(run_timer(mc, timer))
|
|
4717
4788
|
TIMERS[LAST_TIMER_ID] = timer
|
|
4718
4789
|
if json_output:
|
|
@@ -4723,7 +4794,10 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4723
4794
|
case "timer_cancel":
|
|
4724
4795
|
argnum = 1
|
|
4725
4796
|
nb = int(cmds[1])
|
|
4726
|
-
timer = TIMERS.pop(nb)
|
|
4797
|
+
timer = TIMERS.pop(nb, None)
|
|
4798
|
+
if timer is None:
|
|
4799
|
+
logger.error(f"No timer {nb} (unknown, cancelled or already finished)")
|
|
4800
|
+
return (cmds[argnum+1:], output_str)
|
|
4727
4801
|
timer["task"].cancel()
|
|
4728
4802
|
try:
|
|
4729
4803
|
await timer["task"]
|
|
@@ -4819,7 +4893,7 @@ def command_help():
|
|
|
4819
4893
|
aliases_load : load aliases from a file
|
|
4820
4894
|
handler_attach <d> <c> : attach c as a handler for d
|
|
4821
4895
|
handler_detach <n> : detach an handler (from its handle n)
|
|
4822
|
-
timer <s> <c>
|
|
4896
|
+
timer [-x] [-n<k>] <s> <c> : runs command c every s seconds (k times if -n, now if -x)
|
|
4823
4897
|
timer_cancel <n> : cancels a timer (from its handle n)
|
|
4824
4898
|
timers : lists current timers
|
|
4825
4899
|
Messaging
|
|
@@ -4910,6 +4984,7 @@ def command_usage() :
|
|
|
4910
4984
|
-a <address> : specifies device address (can be a name)
|
|
4911
4985
|
-d <name> : filter meshcore devices with name or address
|
|
4912
4986
|
-P : forces pairing via the OS
|
|
4987
|
+
--pin <pin> : forces pairing via the OS using this pin
|
|
4913
4988
|
-t <hostname> : connects via tcp/ip
|
|
4914
4989
|
-p <port> : specifies tcp port (default 5000)
|
|
4915
4990
|
-s <port>[:opts]: use serial port <port>
|
|
@@ -5266,13 +5341,16 @@ meshcore-cli lets you attach shell process to msg rx_log chan_data or telemetry
|
|
|
5266
5341
|
""")
|
|
5267
5342
|
|
|
5268
5343
|
elif "timer" in cmdname:
|
|
5269
|
-
print("""timer [-j] [-c<contact>] [-s<scope>] <s> <line>: runs line every s seconds (s can be postfixed with s, m, h or d)
|
|
5344
|
+
print("""timer [-j] [-x] [-n<count>] [-c<contact>] [-s<scope>] [-u] [-f] <s> <line>: runs line every s seconds (s can be postfixed with s, m, h or d)
|
|
5270
5345
|
|
|
5271
5346
|
* args:
|
|
5272
5347
|
- `-j` forces json output for the timed line.
|
|
5348
|
+
- `-x` executes the line immediately, then every `s` seconds (without it, the first run happens after `s` seconds).
|
|
5349
|
+
- `-n` runs the line `count` times, then disarms the timer (default: runs until cancelled).
|
|
5273
5350
|
- `-c` sets the contact the line is run from (`~` for root).
|
|
5274
5351
|
- `-s` sets the scope for the line, defaults to the current scope.
|
|
5275
|
-
|
|
5352
|
+
- `-u` will execute the command unbuffered in case of redirection (buffering is necessary to easily print output above prompt).
|
|
5353
|
+
- `-f` prints a message when the timer has finished.
|
|
5276
5354
|
* `timer_cancel <n>` cancels timer number `n`
|
|
5277
5355
|
* `timers` lists current timers
|
|
5278
5356
|
|
|
@@ -5811,7 +5889,7 @@ async def main(argv):
|
|
|
5811
5889
|
address = f.readline().strip()
|
|
5812
5890
|
|
|
5813
5891
|
try:
|
|
5814
|
-
opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:fjDhvSlT:Pc:Crqi")
|
|
5892
|
+
opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:fjDhvSlT:Pc:Crqi", ["pin="])
|
|
5815
5893
|
except getopt.GetoptError:
|
|
5816
5894
|
print("Unrecognized option, use -h to get more help")
|
|
5817
5895
|
command_usage()
|
|
@@ -5833,6 +5911,8 @@ async def main(argv):
|
|
|
5833
5911
|
address = arg
|
|
5834
5912
|
case "-P" : # pairing
|
|
5835
5913
|
pin = True
|
|
5914
|
+
case "--pin" : # pairing with a given pin
|
|
5915
|
+
pin = arg
|
|
5836
5916
|
case "-s" : # serial port
|
|
5837
5917
|
if ":" in arg:
|
|
5838
5918
|
serial_opts=arg.split(":",1)[1].split(',')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|