mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
feat: Add paginate parameter to cmd_web
This commit is contained in:
parent
e255c28353
commit
584813c0f3
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue