2022-09-14 16:52:49 -05:00
|
|
|
#% extends "py-script.mk" %#
|
|
|
|
#% block name %#confirm#% endblock %#
|
|
|
|
#% block script %#
|
|
|
|
|
|
|
|
import sys
|
2022-09-16 12:47:21 -05:00
|
|
|
|
2022-10-12 16:38:41 -05:00
|
|
|
###-
|
|
|
|
# this is just to trick the LSP during development
|
|
|
|
from utils import a
|
|
|
|
|
|
|
|
# -###
|
2022-09-24 16:20:23 -05:00
|
|
|
##- '$(utils_py)' -##
|
2022-09-14 16:52:49 -05:00
|
|
|
|
2022-09-16 12:47:21 -05:00
|
|
|
|
2022-09-14 16:52:49 -05:00
|
|
|
def confirm():
|
|
|
|
"""
|
|
|
|
Ask user to enter Y or N (case-insensitive).
|
|
|
|
:return: True if the answer is Y.
|
|
|
|
:rtype: bool
|
|
|
|
"""
|
|
|
|
answer = ""
|
|
|
|
while answer not in ["y", "n"]:
|
2022-10-12 16:38:41 -05:00
|
|
|
sys.stderr.write(f"""$(2) {a.b_red}[Y/n]{a.end} \n""")
|
|
|
|
answer = input().lower()
|
2022-09-14 16:52:49 -05:00
|
|
|
return answer == "y"
|
|
|
|
|
2022-09-16 12:47:21 -05:00
|
|
|
|
2022-09-14 16:52:49 -05:00
|
|
|
if confirm():
|
2022-09-20 17:09:42 -05:00
|
|
|
sys.exit()
|
2022-09-14 16:52:49 -05:00
|
|
|
else:
|
2022-09-22 10:39:53 -05:00
|
|
|
sys.exit(1)
|
2022-09-14 16:52:49 -05:00
|
|
|
#% endblock %#
|