diff --git a/it/src/get_command.py b/it/src/get_command.py new file mode 100755 index 0000000..83c6fbf --- /dev/null +++ b/it/src/get_command.py @@ -0,0 +1,13 @@ +from parse_command import parse_command + +def get_command(prompt): + try: + return parse_command(input(prompt)) + except KeyboardInterrupt: # bastard behavior from ed + pass + except EOFError: + return 0 + +def main(buffer, command): + print("Command returned as %s" % get_command("Input command (won't be executed): ")) + return buffer diff --git a/it/src/it.py b/it/src/it.py index dd6cb40..8056c36 100755 --- a/it/src/it.py +++ b/it/src/it.py @@ -1,20 +1,12 @@ #!/usr/bin/env python3 import sys from buffer import Buffer -from parse_command import parse_command +from get_command import get_command def version(): print("it.py line editor; ALPHA 2021") return None -def get_command(): - try: - return parse_command(input()) - except KeyboardInterrupt: # bastard behavior from ed - pass - except EOFError: - return 0 - def main(buffer, supplied_command): if supplied_command != [] and len(supplied_command) > 1: command = supplied_command[1:]