1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2025-12-07 09:03:06 +00:00
kiwi-scp/src/kiwi/subcommands/utils/user_input.py

24 lines
574 B
Python
Raw Normal View History

2020-08-17 12:51:11 +00:00
def are_you_sure(prompt, default="no"):
if default.lower() == 'yes':
suffix = "[YES|no]"
else:
suffix = "[yes|NO]"
answer = input(
"!!!!!!!!!!!!!!!!!!\n"
"!!! BE CAREFUL !!!\n"
"!!!!!!!!!!!!!!!!!!\n"
"\n"
f"{prompt}\n"
"\n"
f"Are you sure you want to proceed? {suffix} "
).strip().lower()
if answer == '':
answer = default
while answer not in ['yes', 'no']:
answer = input("Please type 'yes' or 'no' explicitly: ").strip().lower()
return answer == 'yes'