From 5fd864f5e94800015efc8c954bd7487b66d915d9 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 9 Aug 2024 17:17:27 -0400 Subject: [PATCH] feat: Replace SystemPager with pypager in cmd_web --- aider/commands.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index fa22298b7..069114b40 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -120,6 +120,9 @@ class Commands: def cmd_web(self, args): "Scrape a webpage, convert to markdown and add to the chat" + from pypager.source import StringSource + from pypager.pager import Pager + url = args.strip() if not url: self.io.tool_error("Please provide a URL to scrape.") @@ -135,11 +138,14 @@ class Commands: ) content = self.scraper.scrape(url) or "" - # if content: - # self.io.tool_output(content) - content = f"{url}:\n\n" + content + # Use pypager to show the content + source = StringSource(content) + pager = Pager() + pager.add_source(source) + pager.run() + return content def is_command(self, inp):