mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
feat: Replace SystemPager with pypager in cmd_web
This commit is contained in:
parent
c290001a9f
commit
5fd864f5e9
1 changed files with 9 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue