2023-09-17

This commit is contained in:
2023-09-18 00:53:58 -04:00
parent a69c37e1db
commit 97e588cc89
19 changed files with 177 additions and 65 deletions
View File
View File
View File
View File
View File
View File
View File
View File
+37 -2
View File
@@ -1,3 +1,38 @@
#!/bin/sh
#!/usr/bin/env python3
import sys
from buffer import Buffer
from get_command import get_command
python3 src/it.py "$@"
def version():
print("it.py line editor; ALPHA 2021")
return None
def main(buffer, supplied_command):
if supplied_command != [] and len(supplied_command) > 1:
command = supplied_command[1:]
else:
command = get_command("")
while True:
# EOFError in get_command(); ^D
if command == 0:
break
if command == []:
continue
if command[0] in buffer.modules.keys() or buffer.import_module_(command[0]):
buffer = buffer.modules[command[0]].main(buffer, command)
if type(buffer) is int:
break
command = get_command("")
return buffer
if __name__ == "__main__":
buffer = main(Buffer(), [])
if type(buffer) is int:
sys.exit(buffer)
else:
sys.exit(0)
View File
View File
View File
-38
View File
@@ -1,38 +0,0 @@
#!/usr/bin/env python3
import sys
from buffer import Buffer
from get_command import get_command
def version():
print("it.py line editor; ALPHA 2021")
return None
def main(buffer, supplied_command):
if supplied_command != [] and len(supplied_command) > 1:
command = supplied_command[1:]
else:
command = get_command("")
while True:
# EOFError in get_command(); ^D
if command == 0:
break
if command == []:
continue
if command[0] in buffer.modules.keys() or buffer.import_module_(command[0]):
buffer = buffer.modules[command[0]].main(buffer, command)
if type(buffer) is int:
break
command = get_command("")
return buffer
if __name__ == "__main__":
buffer = main(Buffer(), [])
if type(buffer) is int:
sys.exit(buffer)
else:
sys.exit(0)
View File