1
0

separate get_command

This commit is contained in:
Deven Blake 2021-05-31 22:59:48 -04:00
parent 60e04e42f4
commit b03ff6813c
2 changed files with 14 additions and 9 deletions

13
it/src/get_command.py Executable file
View File

@ -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

View File

@ -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:]