mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 08:19:23 +00:00
Pause before clearing screen
This commit is contained in:
@@ -52,7 +52,7 @@ from utils.password_prompt import (
|
|||||||
)
|
)
|
||||||
from utils.memory_protection import InMemorySecret
|
from utils.memory_protection import InMemorySecret
|
||||||
from utils.clipboard import copy_to_clipboard
|
from utils.clipboard import copy_to_clipboard
|
||||||
from utils.terminal_utils import clear_screen
|
from utils.terminal_utils import clear_screen, pause
|
||||||
from constants import MIN_HEALTHY_RELAYS
|
from constants import MIN_HEALTHY_RELAYS
|
||||||
|
|
||||||
from constants import (
|
from constants import (
|
||||||
@@ -1285,11 +1285,13 @@ class PasswordManager:
|
|||||||
).strip()
|
).strip()
|
||||||
if not index_input.isdigit():
|
if not index_input.isdigit():
|
||||||
print(colored("Error: Index must be a number.", "red"))
|
print(colored("Error: Index must be a number.", "red"))
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
index = int(index_input)
|
index = int(index_input)
|
||||||
|
|
||||||
entry = self.entry_manager.retrieve_entry(index)
|
entry = self.entry_manager.retrieve_entry(index)
|
||||||
if not entry:
|
if not entry:
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
|
|
||||||
entry_type = entry.get("type", EntryType.PASSWORD.value)
|
entry_type = entry.get("type", EntryType.PASSWORD.value)
|
||||||
@@ -1345,6 +1347,7 @@ class PasswordManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error generating TOTP code: {e}", exc_info=True)
|
logging.error(f"Error generating TOTP code: {e}", exc_info=True)
|
||||||
print(colored(f"Error: Failed to generate TOTP code: {e}", "red"))
|
print(colored(f"Error: Failed to generate TOTP code: {e}", "red"))
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
if entry_type == EntryType.SSH.value:
|
if entry_type == EntryType.SSH.value:
|
||||||
notes = entry.get("notes", "")
|
notes = entry.get("notes", "")
|
||||||
@@ -1379,6 +1382,7 @@ class PasswordManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error deriving SSH key pair: {e}", exc_info=True)
|
logging.error(f"Error deriving SSH key pair: {e}", exc_info=True)
|
||||||
print(colored(f"Error: Failed to derive SSH keys: {e}", "red"))
|
print(colored(f"Error: Failed to derive SSH keys: {e}", "red"))
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
if entry_type == EntryType.SEED.value:
|
if entry_type == EntryType.SEED.value:
|
||||||
notes = entry.get("notes", "")
|
notes = entry.get("notes", "")
|
||||||
@@ -1428,6 +1432,7 @@ class PasswordManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error deriving seed phrase: {e}", exc_info=True)
|
logging.error(f"Error deriving seed phrase: {e}", exc_info=True)
|
||||||
print(colored(f"Error: Failed to derive seed phrase: {e}", "red"))
|
print(colored(f"Error: Failed to derive seed phrase: {e}", "red"))
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
if entry_type == EntryType.PGP.value:
|
if entry_type == EntryType.PGP.value:
|
||||||
notes = entry.get("notes", "")
|
notes = entry.get("notes", "")
|
||||||
@@ -1460,6 +1465,7 @@ class PasswordManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error deriving PGP key: {e}", exc_info=True)
|
logging.error(f"Error deriving PGP key: {e}", exc_info=True)
|
||||||
print(colored(f"Error: Failed to derive PGP key: {e}", "red"))
|
print(colored(f"Error: Failed to derive PGP key: {e}", "red"))
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
if entry_type == EntryType.NOSTR.value:
|
if entry_type == EntryType.NOSTR.value:
|
||||||
label = entry.get("label", "")
|
label = entry.get("label", "")
|
||||||
@@ -1492,6 +1498,7 @@ class PasswordManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error deriving Nostr keys: {e}", exc_info=True)
|
logging.error(f"Error deriving Nostr keys: {e}", exc_info=True)
|
||||||
print(colored(f"Error: Failed to derive Nostr keys: {e}", "red"))
|
print(colored(f"Error: Failed to derive Nostr keys: {e}", "red"))
|
||||||
|
pause()
|
||||||
return
|
return
|
||||||
|
|
||||||
website_name = entry.get("website")
|
website_name = entry.get("website")
|
||||||
@@ -1578,9 +1585,11 @@ class PasswordManager:
|
|||||||
print(colored(f" {label}: {value}", "cyan"))
|
print(colored(f" {label}: {value}", "cyan"))
|
||||||
else:
|
else:
|
||||||
print(colored("Error: Failed to retrieve the password.", "red"))
|
print(colored("Error: Failed to retrieve the password.", "red"))
|
||||||
|
pause()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error during password retrieval: {e}", exc_info=True)
|
logging.error(f"Error during password retrieval: {e}", exc_info=True)
|
||||||
print(colored(f"Error: Failed to retrieve password: {e}", "red"))
|
print(colored(f"Error: Failed to retrieve password: {e}", "red"))
|
||||||
|
pause()
|
||||||
|
|
||||||
def handle_modify_entry(self) -> None:
|
def handle_modify_entry(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
@@ -28,7 +28,7 @@ try:
|
|||||||
from .input_utils import timed_input
|
from .input_utils import timed_input
|
||||||
from .memory_protection import InMemorySecret
|
from .memory_protection import InMemorySecret
|
||||||
from .clipboard import copy_to_clipboard
|
from .clipboard import copy_to_clipboard
|
||||||
from .terminal_utils import clear_screen
|
from .terminal_utils import clear_screen, pause
|
||||||
|
|
||||||
if logger.isEnabledFor(logging.DEBUG):
|
if logger.isEnabledFor(logging.DEBUG):
|
||||||
logger.info("Modules imported successfully.")
|
logger.info("Modules imported successfully.")
|
||||||
@@ -57,4 +57,5 @@ __all__ = [
|
|||||||
"InMemorySecret",
|
"InMemorySecret",
|
||||||
"copy_to_clipboard",
|
"copy_to_clipboard",
|
||||||
"clear_screen",
|
"clear_screen",
|
||||||
|
"pause",
|
||||||
]
|
]
|
||||||
|
@@ -1,6 +1,18 @@
|
|||||||
"""Utility functions for terminal output."""
|
"""Utility functions for terminal output."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def clear_screen() -> None:
|
def clear_screen() -> None:
|
||||||
"""Clear the terminal screen using an ANSI escape code."""
|
"""Clear the terminal screen using an ANSI escape code."""
|
||||||
print("\033c", end="")
|
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
|
||||||
|
Reference in New Issue
Block a user