mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
color edits
This commit is contained in:
parent
c9efc43c98
commit
d0222a7129
2 changed files with 13 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
@ -51,9 +52,7 @@ class Coder:
|
||||||
self.set_repo(fnames)
|
self.set_repo(fnames)
|
||||||
|
|
||||||
if not self.repo:
|
if not self.repo:
|
||||||
self.console.print(
|
self.console.print("[red]No suitable git repo, will not automatically commit edits.")
|
||||||
"[red]No suitable git repo, will not automatically commit edits."
|
|
||||||
)
|
|
||||||
self.find_common_root()
|
self.find_common_root()
|
||||||
|
|
||||||
self.pretty = pretty
|
self.pretty = pretty
|
||||||
|
@ -112,18 +111,12 @@ class Coder:
|
||||||
self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:")
|
self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:")
|
||||||
for fn in new_files:
|
for fn in new_files:
|
||||||
self.console.print(f"[bright_black] {fn}")
|
self.console.print(f"[bright_black] {fn}")
|
||||||
if Confirm.ask(
|
if Confirm.ask("[bright_black]Add them?", console=self.console, default="y"):
|
||||||
"[bright_black]Add them?", console=self.console, default="y"
|
|
||||||
):
|
|
||||||
for relative_fname in new_files:
|
for relative_fname in new_files:
|
||||||
repo.git.add(relative_fname)
|
repo.git.add(relative_fname)
|
||||||
self.console.print(
|
self.console.print(f"[bright_black]Added {relative_fname} to the git repo")
|
||||||
f"[bright_black]Added {relative_fname} to the git repo"
|
|
||||||
)
|
|
||||||
show_files = ", ".join(new_files)
|
show_files = ", ".join(new_files)
|
||||||
commit_message = (
|
commit_message = f"Initial commit: Added new files to the git repo: {show_files}"
|
||||||
f"Initial commit: Added new files to the git repo: {show_files}"
|
|
||||||
)
|
|
||||||
repo.git.commit("-m", commit_message, "--no-verify")
|
repo.git.commit("-m", commit_message, "--no-verify")
|
||||||
self.console.print(
|
self.console.print(
|
||||||
f"[bright_black]Committed new files with message: {commit_message}"
|
f"[bright_black]Committed new files with message: {commit_message}"
|
||||||
|
@ -361,7 +354,9 @@ class Coder:
|
||||||
if not Path(full_path).exists():
|
if not Path(full_path).exists():
|
||||||
question = f"[bright_black]Allow creation of new file {path}?"
|
question = f"[bright_black]Allow creation of new file {path}?"
|
||||||
else:
|
else:
|
||||||
question = f"[bright_black]Allow edits to {path} which was not previously provided?"
|
question = (
|
||||||
|
f"[bright_black]Allow edits to {path} which was not previously provided?"
|
||||||
|
)
|
||||||
if not Confirm.ask(question, console=self.console, default="y"):
|
if not Confirm.ask(question, console=self.console, default="y"):
|
||||||
self.console.print(f"[red]Skipping edit to {path}")
|
self.console.print(f"[red]Skipping edit to {path}")
|
||||||
continue
|
continue
|
||||||
|
@ -454,9 +449,7 @@ class Coder:
|
||||||
self.last_modified = self.get_last_modified()
|
self.last_modified = self.get_last_modified()
|
||||||
|
|
||||||
self.console.print("[bright_black]Files have uncommitted changes.\n")
|
self.console.print("[bright_black]Files have uncommitted changes.\n")
|
||||||
self.console.print(
|
self.console.print(f"[bright_black]Suggested commit message:\n{commit_message}\n")
|
||||||
f"[bright_black]Suggested commit message:\n{commit_message}\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
res = Prompt.ask(
|
res = Prompt.ask(
|
||||||
"[bright_black]Commit before the chat proceeds? \[y/n/commit message]", # noqa: W605
|
"[bright_black]Commit before the chat proceeds? \[y/n/commit message]", # noqa: W605
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue