Add unit tests dedicated for Shell helper sample class. Add shell_simulator_script.py script to simulate shell application behavior. Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
31 lines
628 B
Python
31 lines
628 B
Python
# Copyright (c) 2023 Nordic Semiconductor ASA
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
"""
|
|
Simple shell simulator.
|
|
"""
|
|
import sys
|
|
|
|
from zen_of_python import zen_of_python
|
|
|
|
PROMPT = 'uart:~$ '
|
|
|
|
|
|
def main() -> int:
|
|
print('Start shell simulator', flush=True)
|
|
print(PROMPT, end='', flush=True)
|
|
for line in sys.stdin:
|
|
line = line.strip()
|
|
print(line, flush=True)
|
|
if line == 'quit':
|
|
break
|
|
elif line == 'zen':
|
|
for zen_line in zen_of_python:
|
|
print(zen_line, flush=True)
|
|
|
|
print(PROMPT, end='', flush=True)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|