feat: user input with nano
This commit is contained in:
parent
2d5e23c8a9
commit
74f93f809a
15
python/user_input_nano.py
Normal file
15
python/user_input_nano.py
Normal 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
|
Loading…
Reference in New Issue
Block a user