feat(input): Password prompt, rename
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user