|
23 | 23 | from meshcore import MeshCore, EventType, logger |
24 | 24 |
|
25 | 25 | # Version |
26 | | -VERSION = "v1.1.37" |
| 26 | +VERSION = "v1.1.38" |
27 | 27 |
|
28 | 28 | # default ble address is stored in a config file |
29 | 29 | MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" |
@@ -1801,18 +1801,26 @@ async def next_cmd(mc, cmds, json_output=False): |
1801 | 1801 | if json_output: |
1802 | 1802 | print(json.dumps(ev.payload, indent=2)) |
1803 | 1803 | else : |
| 1804 | + classic = interactive_loop.classic or not process_event_message.color |
1804 | 1805 | print("]",end="") |
1805 | 1806 | for t in ev.payload["path"]: |
1806 | | - print("→",end="") |
| 1807 | + if classic : |
| 1808 | + print("→",end="") |
| 1809 | + else: |
| 1810 | + print(f" {ANSI_INVERT}", end="") |
1807 | 1811 | snr = t['snr'] |
1808 | 1812 | if snr >= 10 : |
1809 | | - print(ANSI_GREEN, end="") |
| 1813 | + print(ANSI_BGREEN, end="") |
1810 | 1814 | elif snr <= 0: |
1811 | | - print(ANSI_RED, end="") |
| 1815 | + print(ANSI_BRED, end="") |
| 1816 | + else : |
| 1817 | + print(ANSI_BGRAY, end="") |
1812 | 1818 | print(f"{snr:.2f}",end="") |
1813 | | - if snr >= 10 or snr <= 0: |
1814 | | - print(ANSI_END, end="") |
1815 | | - print("→",end="") |
| 1819 | + if classic : |
| 1820 | + print("→",end="") |
| 1821 | + else : |
| 1822 | + print(f"{ANSI_NORMAL}🭬",end="") |
| 1823 | + print(ANSI_END, end="") |
1816 | 1824 | if "hash" in t: |
1817 | 1825 | print(f"[{t['hash']}]",end="") |
1818 | 1826 | else: |
@@ -2427,9 +2435,11 @@ async def process_script(mc, file, json_output=False): |
2427 | 2435 | lines=f.readlines() |
2428 | 2436 |
|
2429 | 2437 | for line in lines: |
2430 | | - logger.debug(f"processing {line}") |
2431 | | - cmds = shlex.split(line[:-1]) |
2432 | | - await process_cmds(mc, cmds, json_output) |
| 2438 | + line = line.strip() |
| 2439 | + if not (line == "" or line[0] == "#"): |
| 2440 | + logger.debug(f"processing {line}") |
| 2441 | + cmds = shlex.split(line) |
| 2442 | + await process_cmds(mc, cmds, json_output) |
2433 | 2443 |
|
2434 | 2444 | def version(): |
2435 | 2445 | print (f"meshcore-cli: command line interface to MeshCore companion radios {VERSION}") |
|
0 commit comments