1# Copyright (c) 2023 Nordic Semiconductor ASA 2# 3# SPDX-License-Identifier: Apache-2.0 4 5""" 6Simple shell simulator. 7""" 8 9import sys 10 11from zen_of_python import zen_of_python 12 13PROMPT = 'uart:~$ ' 14 15 16def main() -> int: 17 print('Start shell simulator', flush=True) 18 print(PROMPT, end='', flush=True) 19 for line in sys.stdin: 20 line = line.strip() 21 print(line, flush=True) 22 if line == 'quit': 23 break 24 elif line == 'zen': 25 for zen_line in zen_of_python: 26 print(zen_line, flush=True) 27 28 print(PROMPT, end='', flush=True) 29 30 31if __name__ == '__main__': 32 main() 33