fix(hsr): proper implement --noconfirm

This commit is contained in:
tretrauit 2024-01-25 20:18:56 +07:00
parent 80f1ea87d7
commit 4c851b999a
2 changed files with 18 additions and 2 deletions

View File

@ -25,7 +25,7 @@ default_options = [
option("patch-type", "p", description="Patch type", flag=False),
option("temporary-path", "t", description="Temporary path", flag=False),
option("silent", "s", description="Silent mode"),
option("noconfirm", "y", description="Do not ask for confirmation"),
option("noconfirm", "y", description="Do not ask for confirmation (yes to all)"),
]
@ -62,6 +62,16 @@ def callback(
utils.silent_message = silent
if noconfirm:
utils.no_confirm = noconfirm
def confirm(
question: str, default: bool = False, true_answer_regex: str = r"(?i)^y"
):
command.line(
f"<question>{question} (yes/no)</question> [<comment>{'yes' if default else 'no'}</comment>] y"
)
return True
command.confirm = confirm
command.add_style("warn", fg="yellow")
@ -116,8 +126,13 @@ class PatchInstallCommand(Command):
self.line(
"You need to <warn>run the game using Jadeite</warn> to use the patch."
)
self.line(f'E.g: <question>{exe_path} "{State.game.path}"</question>')
print()
self.line(
f'E.g: <question>I_WANT_A_BAN=1 {exe_path} "{State.game.path}"</question>'
"To activate the experimental patching method, set the environment variable BREAK_CATHACK=1"
)
self.line(
"Read more about it here: https://codeberg.org/mkrsym1/jadeite/issues/37"
)
print()
self.line(

View File

@ -47,6 +47,7 @@ class ProgressIndicator:
interval=interval, values=values
)
self.thread = Thread(target=self.auto_advance)
self.thread.daemon = True
def start(self, message: str):
"""