Files
deepdog/deepdog/cli/util/confirm.py
Deepak Mallubhotla 36ff75576c
All checks were successful
gitea-physics/deepdog/pipeline/head This commit looks good
chore: removes redundant import
2024-05-21 15:55:25 -05:00

24 lines
441 B
Python

_RESPONSE_MAP = {
"yes": True,
"ye": True,
"y": True,
"no": False,
"n": False,
"nope": False,
"true": True,
"false": False,
}
def confirm_prompt(question: str) -> bool:
"""Prompt with the question and returns yes or no based on response."""
prompt = question + " [y/n]: "
while True:
choice = input(prompt).lower()
if choice in _RESPONSE_MAP:
return _RESPONSE_MAP[choice]
else:
print('Respond with "yes" or "no"')