Skip to content

Commit f00c7ee

Browse files
committed
Manage and print version for UX
1 parent 758383f commit f00c7ee

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

flash_utils/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""API for cross platform flashing"""
2+
3+
__version__ = "1.0.2"

flash_utils/flash.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import serial
1313
from tqdm import tqdm
1414

15+
from . import __version__
16+
1517
FLASH_WRITER_FILE_DEFAULT = "Flash_Writer_SCIF_rzboard.mot"
1618
BL2_FILE_DEFAULT = "bl2_bp-rzboard.srec"
1719
FIP_FILE_DEFAULT = "fip-rzboard.srec"
@@ -60,7 +62,7 @@ def __init__(self):
6062
self.write_system_image()
6163
else:
6264
argparser.error(
63-
"Please specify which image(s) to flash.\n\nExamples:\n\t"
65+
f"Please specify which image(s) to flash.\n\nv{__version__} Examples:\n\t"
6466
"\n\tUsing default path of files in flash_rzboard.py dir\n\t"
6567
"./flash_util.py --bootloader\n\t"
6668
"./flash_util.py --bootloader --qspi\n\t"
@@ -213,9 +215,14 @@ def argparse_and_override_defaults(self):
213215
help="Flash to QSPI (default is eMMC).",
214216
)
215217

218+
# Debug / help
216219
argparser.add_argument(
217220
"--debug", action="store_true", help="Enable debug output (buffer printing)"
218221
)
222+
argparser.add_argument(
223+
"--version", "-v", action="version",
224+
help="Show version.", version=f"%(prog)s {__version__},"
225+
)
219226

220227
self.__args = argparser.parse_args()
221228
self.handle_path_overrides()

0 commit comments

Comments
 (0)