feat: Add paginate parameter to cmd_web

This commit is contained in:
Paul Gauthier (aider) 2024-08-09 17:25:20 -04:00
parent e255c28353
commit 584813c0f3

View file

@ -120,7 +120,7 @@ class Commands:
else: else:
self.io.tool_output("Please provide a partial model name to search for.") self.io.tool_output("Please provide a partial model name to search for.")
def cmd_web(self, args): def cmd_web(self, args, paginate=True):
"Scrape a webpage, convert to markdown and add to the chat" "Scrape a webpage, convert to markdown and add to the chat"
url = args.strip() url = args.strip()
@ -140,11 +140,14 @@ class Commands:
content = self.scraper.scrape(url) or "" content = self.scraper.scrape(url) or ""
content = f"{url}:\n\n" + content content = f"{url}:\n\n" + content
# Use pypager to show the content if paginate:
source = StringSource(content) # Use pypager to show the content
pager = Pager() source = StringSource(content)
pager.add_source(source) pager = Pager()
pager.run() pager.add_source(source)
pager.run()
else:
self.io.tool_output(content)
return content return content