feat: user input with nano

This commit is contained in:
Hazel 2024-04-18 12:45:22 +02:00
parent 2d5e23c8a9
commit 74f93f809a

15
python/user_input_nano.py Normal file
View File

@ -0,0 +1,15 @@
from pathlib import Path
import tempfile
import subprocess
def input_nano() -> str:
f = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
n = f.name
f.close()
subprocess.call(['nano', n])
with open(n, 'r') as f:
input_string = f.read()
Path(n).unlink()
return input_string