mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
fix: Add paginate option to cmd_diff method
This commit is contained in:
parent
566ac8d641
commit
c3e08a80eb
1 changed files with 10 additions and 3 deletions
|
@ -467,7 +467,7 @@ class Commands:
|
||||||
if self.coder.main_model.send_undo_reply:
|
if self.coder.main_model.send_undo_reply:
|
||||||
return prompts.undo_command_reply
|
return prompts.undo_command_reply
|
||||||
|
|
||||||
def cmd_diff(self, args=""):
|
def cmd_diff(self, args="", paginate=False):
|
||||||
"Display the diff of the last aider commit"
|
"Display the diff of the last aider commit"
|
||||||
if not self.coder.repo:
|
if not self.coder.repo:
|
||||||
self.io.tool_error("No git repository found.")
|
self.io.tool_error("No git repository found.")
|
||||||
|
@ -486,8 +486,15 @@ class Commands:
|
||||||
"HEAD",
|
"HEAD",
|
||||||
)
|
)
|
||||||
|
|
||||||
# don't use io.tool_output() because we don't want to log or further colorize
|
if paginate:
|
||||||
print(diff)
|
# Use pypager to show the content
|
||||||
|
source = StringSource(diff)
|
||||||
|
pager = Pager()
|
||||||
|
pager.add_source(source)
|
||||||
|
pager.run()
|
||||||
|
else:
|
||||||
|
# don't use io.tool_output() because we don't want to log or further colorize
|
||||||
|
print(diff)
|
||||||
|
|
||||||
def quote_fname(self, fname):
|
def quote_fname(self, fname):
|
||||||
if " " in fname and '"' not in fname:
|
if " " in fname and '"' not in fname:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue