diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8b6db9..9a992507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Added support for timestamped comments in CLI via `rem`, `;`, `%` or `#` (@doegox) - Fixed watchdog trigger during `hw factory_reset` (@doegox) - Added PyInstaller support for CLI client (@augustozanellato) diff --git a/software/script/chameleon_cli_main.py b/software/script/chameleon_cli_main.py index b58eb65b..6682ac8c 100755 --- a/software/script/chameleon_cli_main.py +++ b/software/script/chameleon_cli_main.py @@ -9,6 +9,7 @@ import os import pathlib import prompt_toolkit +from datetime import datetime from prompt_toolkit.formatted_text import ANSI from prompt_toolkit.history import FileHistory @@ -127,6 +128,18 @@ def startCLI(self): # parse cmd argv = cmd_str.split() root_cmd = argv[0] + # look for comments + if root_cmd == "rem" or root_cmd[0] in ";#%": + # precision: second + # iso_timestamp = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') + # precision: nanosecond (note that the comment will take some time too, ~75ns, check your system) + iso_timestamp = datetime.utcnow().isoformat() + 'Z' + if root_cmd[0] in ";#%": + comment = ' '.join([root_cmd[1:]]+argv[1:]).strip() + else: + comment = ' '.join(argv[1:]).strip() + print(f"{iso_timestamp} remark: {comment}") + continue if root_cmd not in chameleon_cli_unit.root_commands: # No matching command group print("".ljust(18, "-") + "".ljust(10) + "".ljust(30, "-"))