forked from Mirror/pmbootstrap
pmb/install: warn if the target disk is larger than expected (MR 1956)
This commit is contained in:
parent
72e24f7f96
commit
5d540ad4fb
2 changed files with 32 additions and 4 deletions
|
@ -86,13 +86,15 @@ def ask(args, question="Continue?", choices=["y", "n"], default="n",
|
|||
validation_regex + "). Please try again.")
|
||||
|
||||
|
||||
def confirm(args, question="Continue?", default=False):
|
||||
def confirm(args, 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):
|
||||
if args.assume_yes and not no_assumptions:
|
||||
logging.info(question + " (y/n) [" + default_str + "]: y")
|
||||
return True
|
||||
answer = ask(args, question, ["y", "n"], default_str, True, "(y|n)")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue