2022-12-07 21:01:59 +01:00
|
|
|
import editor
|
2022-12-29 18:50:57 +01:00
|
|
|
import terminal
|
2022-12-07 21:01:59 +01:00
|
|
|
|
2022-12-29 17:54:51 +01:00
|
|
|
let e = newEditor(">>> ")
|
2022-12-07 21:01:59 +01:00
|
|
|
|
|
|
|
while true:
|
2022-12-28 18:12:29 +01:00
|
|
|
let (res, text) = e.read()
|
|
|
|
if res in {erCtrlC, erCtrlD} or text == "quit":
|
2022-12-07 21:01:59 +01:00
|
|
|
break
|
2022-12-29 18:50:57 +01:00
|
|
|
elif text == "clear":
|
|
|
|
eraseScreen()
|
|
|
|
setCursorPos(0, 0)
|
2022-12-30 16:13:18 +01:00
|
|
|
e.updateCursorPos()
|
2022-12-29 18:50:57 +01:00
|
|
|
continue
|
2022-12-29 15:54:08 +01:00
|
|
|
if text.len() > 0:
|
2022-12-30 16:13:18 +01:00
|
|
|
echo text
|
|
|
|
e.updateCursorPos()
|
|
|
|
|
|
|
|
e.destroyEditor()
|