|
1 | 1 | """
|
2 | 2 | MicroPython Remote - Interaction and automation tool for MicroPython
|
3 |
| -MIT license; Copyright (c) 2019-2021 Damien P. George |
| 3 | +MIT license; Copyright (c) 2019-2022 Damien P. George |
4 | 4 |
|
5 | 5 | This program provides a set of utilities to interact with and automate a
|
6 | 6 | MicroPython device over a serial connection. Commands supported are:
|
|
68 | 68 | "run": (True, True, 1, "run the given local script"),
|
69 | 69 | "fs": (True, True, 1, "execute filesystem commands on the device"),
|
70 | 70 | "help": (False, False, 0, "print help and exit"),
|
| 71 | + "version": (False, False, 0, "print version and exit"), |
71 | 72 | }
|
72 | 73 |
|
73 | 74 | _BUILTIN_COMMAND_EXPANSIONS = {
|
|
109 | 110 | "import machine; machine.RTC().datetime((2020, 1, 1, 0, 10, 0, 0, 0))",
|
110 | 111 | ],
|
111 | 112 | "--help": "help",
|
| 113 | + "--version": "version", |
112 | 114 | }
|
113 | 115 |
|
114 | 116 | for port_num in range(4):
|
@@ -465,6 +467,12 @@ def print_commands_help(cmds, help_idx):
|
465 | 467 | print_commands_help(_command_expansions, 2)
|
466 | 468 |
|
467 | 469 |
|
| 470 | +def print_version(): |
| 471 | + from . import __version__ |
| 472 | + |
| 473 | + print(f"{_PROG} {__version__}") |
| 474 | + |
| 475 | + |
468 | 476 | def main():
|
469 | 477 | config = load_user_config()
|
470 | 478 | prepare_command_expansions(config)
|
@@ -498,6 +506,9 @@ def main():
|
498 | 506 | elif cmd == "help":
|
499 | 507 | print_help()
|
500 | 508 | sys.exit(0)
|
| 509 | + elif cmd == "version": |
| 510 | + print_version() |
| 511 | + sys.exit(0) |
501 | 512 | elif cmd == "resume":
|
502 | 513 | auto_soft_reset = False
|
503 | 514 | continue
|
|
0 commit comments