From b55f66df93d5c4f066cddeca40faec4dd06d531d Mon Sep 17 00:00:00 2001 From: Matteo Guadrini Date: Fri, 9 Feb 2024 11:28:59 +0100 Subject: [PATCH] chore: add force argument on confirm function --- utility.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utility.py b/utility.py index 11f3ab3..f1d62f1 100755 --- a/utility.py +++ b/utility.py @@ -259,14 +259,18 @@ def make_symlink(source, destination): warning("MS-DOS file system doesn't support symlink file") -def confirm(message, default="n"): +def confirm(message, default="n", force=False): """ Ask user to enter Y or N (case-insensitive). :message: message to print :default: default answer + :force: ignore prompt message :return: True if the answer is Y. :rtype: bool """ + # If force, answer is "yes" + if force: + return True while ( answer := input( "{0}\nTo continue? {1} ".format(