From 7761bccffe52a59dbb7a3870766754f9412d9ee8 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 7 Nov 2024 10:30:41 -0800 Subject: [PATCH] refactor: replace confirm_ask/webbrowser.open with io.offer_url --- aider/main.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/aider/main.py b/aider/main.py index 04d37442c..2ceeebd2a 100644 --- a/aider/main.py +++ b/aider/main.py @@ -369,8 +369,7 @@ def sanity_check_repo(repo, io): io.tool_error("Aider only works with git repos with version number 1 or 2.") io.tool_output("You may be able to convert your repo: git update-index --index-version=2") io.tool_output("Or run aider --no-git to proceed without using git.") - if io.confirm_ask("Open documentation url for more info?", subject=urls.git_index_version): - webbrowser.open(urls.git_index_version) + io.offer_url(urls.git_index_version, "Open documentation url for more info?") return False io.tool_error("Unable to read git repository, it may be corrupt?") @@ -643,10 +642,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F io.tool_output("You can skip this check with --no-show-model-warnings") try: - if io.confirm_ask( - "Open documentation url for more info?", subject=urls.model_warnings - ): - webbrowser.open(urls.model_warnings) + io.offer_url(urls.model_warnings, "Open documentation url for more info?") io.tool_output() except KeyboardInterrupt: return 1 @@ -871,10 +867,7 @@ def check_and_load_imports(io, verbose=False): except Exception as err: io.tool_error(str(err)) io.tool_output("Error loading required imports. Did you install aider properly?") - if io.confirm_ask( - "Open documentation url for more info?", subject=urls.install_properly - ): - webbrowser.open(urls.install_properly) + io.offer_url(urls.install_properly, "Open documentation url for more info?") sys.exit(1)