Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
prompt
The prompt to present to the user. Can include ANSI and format strings like milc's `cli.print()`.
default
Whether to default to a Yes or No when the user presses enter.
None- force the user to enter Y or N
True- Default to yes
False- Default to no
"""
if not args and kwargs:
args = kwargs
if 'no' in cli.args and cli.args.no:
return False
if 'yes' in cli.args and cli.args.yes:
return True
if default is not None:
if default:
prompt = prompt + ' [Y/n] '
else:
prompt = prompt + ' [y/N] '
while True:
print()
answer = input(format_ansi(prompt % args))
print()