moved console print statements to indicate success or failure of applying edits.

This commit is contained in:
Paul Gauthier 2023-05-09 07:25:20 -07:00
parent d6de4d3877
commit 11a5379d61

View file

@ -377,7 +377,10 @@ class Coder:
self.fnames[path] = 0 self.fnames[path] = 0
edited.add(path) edited.add(path)
self.do_replace(path, original, updated) if self.do_replace(path, original, updated):
self.console.print(f"[red]Applied edit to {fname}")
else:
self.console.print(f"[red]Failed to apply edit to {fname}")
return edited return edited
@ -404,11 +407,9 @@ class Coder:
content, before_text, after_text content, before_text, after_text
) )
if not new_content: if not new_content:
self.console.print(f"[red]Failed to apply edit to {fname}")
return return
fname.write_text(new_content) fname.write_text(new_content)
self.console.print(f"[red]Applied edit to {fname}")
return True return True
def commit(self, history=None, prefix=None, ask=False): def commit(self, history=None, prefix=None, ask=False):