Add very basic test script
This commit is contained in:
parent
811933096f
commit
6fae53e0c8
2 changed files with 80 additions and 33 deletions
|
|
@ -1,33 +0,0 @@
|
|||
import curses
|
||||
import subprocess
|
||||
import tempfile
|
||||
from typing import Any
|
||||
|
||||
|
||||
def main(stdscr: Any) -> None:
|
||||
while True:
|
||||
key = stdscr.getkey()
|
||||
|
||||
if key in {"\x1b", "q"}:
|
||||
return
|
||||
|
||||
elif key == "e":
|
||||
with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
tmpfilename = tmpdirname + "/" + "tempfile"
|
||||
#stdscr.addstr(f"{curses.COLOR_PAIRS!r}\n")
|
||||
stdscr.addstr(f"{tmpdirname!r} | {tmpfilename!r}\n")
|
||||
|
||||
stdscr.getkey()
|
||||
|
||||
curses.endwin()
|
||||
subprocess.run(["nvim", tmpfilename])
|
||||
stdscr.refresh()
|
||||
|
||||
stdscr.getkey()
|
||||
|
||||
with open(tmpfilename) as f:
|
||||
for line in f:
|
||||
stdscr.addstr(line)
|
||||
|
||||
|
||||
curses.wrapper(main)
|
||||
Loading…
Add table
Add a link
Reference in a new issue