Pause before clearing screen

This commit is contained in:
thePR0M3TH3AN committed 2025-07-05 21:53:17 -04:00
1 parent 3cda7208ee
commit 7b9b9a082e
3 files changed
+24 -2

No files matched your search

+2 -1
View File
@@ -28,7 +28,7 @@ try:
from .input_utils import timed_input
from .memory_protection import InMemorySecret
from .clipboard import copy_to_clipboard
from .terminal_utils import clear_screen
from .terminal_utils import clear_screen, pause
if logger.isEnabledFor(logging.DEBUG):
logger.info("Modules imported successfully.")
@@ -57,4 +57,5 @@ __all__ = [
"InMemorySecret",
"copy_to_clipboard",
"clear_screen",
"pause",
]
+12
View File
@@ -1,6 +1,18 @@
"""Utility functions for terminal output."""
import sys
def clear_screen() -> None:
"""Clear the terminal screen using an ANSI escape code."""
print("\033c", end="")
def pause(message: str = "Press Enter to continue...") -> None:
"""Wait for the user to press Enter before proceeding."""
if not sys.stdin or not sys.stdin.isatty():
return
try:
input(message)
except EOFError:
pass