From f89f42491c027b00bdf3cca20c811d2dedee7fd2 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 29 Aug 2024 07:34:39 -0700 Subject: [PATCH] feat: add confirmation step before opening GitHub issue in browser --- aider/report.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/aider/report.py b/aider/report.py index 0c6c6d530..26acd33ab 100644 --- a/aider/report.py +++ b/aider/report.py @@ -23,17 +23,27 @@ def report_github_issue(issue_text, title=None): params["title"] = title issue_url = f"{base_url}?{urllib.parse.urlencode(params)}" - try: - print("Attempting to open the issue URL in your default web browser...") - if webbrowser.open(issue_url): - print("Browser window should be opened.") - else: - print("Unable to open browser window automatically.") - except Exception: - print() - print("Please use this URL to file a GitHub issue:") - print() - print(issue_url) + print("\nIssue Title:") + print(title) + print("\nIssue Body:") + print(issue_text) + print("\nDo you want to open this issue in your browser? (y/n)") + confirmation = input().strip().lower() + + if confirmation == 'y': + try: + print("Attempting to open the issue URL in your default web browser...") + if webbrowser.open(issue_url): + print("Browser window should be opened.") + else: + print("Unable to open browser window automatically.") + except Exception: + print() + print("Please use this URL to file a GitHub issue:") + print() + print(issue_url) + else: + print("Issue creation cancelled.") if __name__ == "__main__":