diff --git a/commands/util/choice.py b/commands/util/input_mgr.py similarity index 72% rename from commands/util/choice.py rename to commands/util/input_mgr.py index a03d73f..0a74b5d 100644 --- a/commands/util/choice.py +++ b/commands/util/input_mgr.py @@ -1,4 +1,6 @@ from typing import Optional +import getpass +import time def choice(default: str, options: str, msg: str) -> str: @@ -28,3 +30,17 @@ def confirm_overwrite(msg: Optional[str] = ""): return confirm( False, (msg if msg != "" else "Do you really want to overwrite your changes?") ) + + +def password(msg: str = ""): + pw = "" + if msg != "": + pw = getpass.getpass(msg) + else: + pw = getpass.getpass() + if pw != "": + return pw + else: + time.sleep(1) + print("Error: Password cannot be empty") + return password(msg)