aboutsummaryrefslogtreecommitdiffstats
path: root/util/prompt.py
blob: d6eb17b39c4da772a90c7f16edacf97dfffe6366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import sys


def query_yes_no(question, default):
    if default == True:
        prompt = " [Y/n] "
    else:
        prompt = " [y/N] "

    sys.stdout.write(question + prompt)
    choice = input().lower()
    return True if choice == "y" else (False if choice == "n" else default)