Refactor shared script helpers
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def prompt_input(prompt: str) -> str:
|
||||
try:
|
||||
return input(prompt)
|
||||
except EOFError as exc:
|
||||
raise RuntimeError("Interactive input ended before choices were complete.") from exc
|
||||
|
||||
|
||||
def pause_if_interactive() -> None:
|
||||
if sys.stdin.isatty():
|
||||
try:
|
||||
input("\nPress Enter to close...")
|
||||
except EOFError:
|
||||
pass
|
||||
Reference in New Issue
Block a user