mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Added support for timestamped comments in CLI via rem, ;, % or #
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import chameleon_utils
|
||||
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 @@ class ChameleonCLI:
|
||||
# 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, "-"))
|
||||
|
||||
Reference in New Issue
Block a user