separate get_command
This commit is contained in:
parent
60e04e42f4
commit
b03ff6813c
13
it/src/get_command.py
Executable file
13
it/src/get_command.py
Executable 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
|
10
it/src/it.py
10
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:]
|
||||
|
Loading…
Reference in New Issue
Block a user