diff --git a/CHANGELOG.md b/CHANGELOG.md index f544e28..559abae 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 pasting several command lines at once with prompt_toolkit (@doegox) - Added support for interrupting sleep sequence with a button press during animation (@doegox) - Fixed logs corruption and app reset on FDS write, added logs flush on sleep (@doegox) - Added support for long-press of buttons (@nemanjan00) diff --git a/software/script/chameleon_cli_main.py b/software/script/chameleon_cli_main.py index 32b5819..7bb0178 100755 --- a/software/script/chameleon_cli_main.py +++ b/software/script/chameleon_cli_main.py @@ -97,14 +97,20 @@ class ChameleonCLI: self.print_banner() closing = False + cmd_strs = [] while True: - # wait user input - try: - cmd_str = self.session.prompt(ANSI(self.get_prompt())).strip() - except EOFError: - closing = True - except KeyboardInterrupt: - closing = True + if cmd_strs: + cmd_str = cmd_strs.pop(0) + else: + # wait user input + try: + cmd_str = self.session.prompt(ANSI(self.get_prompt())).strip() + except EOFError: + closing = True + except KeyboardInterrupt: + closing = True + cmd_strs = cmd_str.replace("\r\n", "\n").replace("\r", "\n").split("\n") + cmd_str = cmd_strs.pop(0) if closing or cmd_str in ["exit", "quit", "q", "e"]: print("Bye, thank you. ^.^ ")