Parse user input, dump to stdout, rinse and repeat. Python REPL style.
()
| 59 | |
| 60 | |
| 61 | def interactive() -> None: |
| 62 | """ |
| 63 | Parse user input, dump to stdout, rinse and repeat. |
| 64 | Python REPL style. |
| 65 | """ |
| 66 | print_heading() |
| 67 | contents = [] |
| 68 | more = False |
| 69 | while True: |
| 70 | try: |
| 71 | prompt, more = ("... ", True) if more else (">>> ", True) |
| 72 | contents.append(input(prompt) + "\n") |
| 73 | except EOFError: |
| 74 | print("\n" + MarkdownIt().render("\n".join(contents)), end="") |
| 75 | more = False |
| 76 | contents = [] |
| 77 | except KeyboardInterrupt: |
| 78 | print("\nExiting.") |
| 79 | break |
| 80 | |
| 81 | |
| 82 | def parse_args(args: Sequence[str] | None) -> argparse.Namespace: |
no test coverage detected
searching dependent graphs…