forked from Mirror/pmbootstrap
more wip (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
34dd9d42ba
commit
48cd886401
34 changed files with 237 additions and 228 deletions
|
@ -98,14 +98,14 @@ def ask(question="Continue?", choices=["y", "n"], default="n",
|
|||
validation_regex + "). Please try again.")
|
||||
|
||||
|
||||
def confirm(args: PmbArgs, question="Continue?", default=False, no_assumptions=False):
|
||||
def confirm(question="Continue?", default=False, no_assumptions=False):
|
||||
"""Convenience wrapper around ask for simple yes-no questions with validation.
|
||||
|
||||
:param no_assumptions: ask for confirmation, even if "pmbootstrap -y' is set
|
||||
:returns: True for "y", False for "n"
|
||||
"""
|
||||
default_str = "y" if default else "n"
|
||||
if args.assume_yes and not no_assumptions:
|
||||
if get_context().assume_yes and not no_assumptions:
|
||||
logging.info(question + " (y/n) [" + default_str + "]: y")
|
||||
return True
|
||||
answer = ask(question, ["y", "n"], default_str, True, "(y|n)")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue