style: format code with linter

This commit is contained in:
Paul Gauthier (aider) 2024-08-28 10:33:13 -07:00
parent 2266f240b1
commit 1eed9dc4e0

View file

@ -21,20 +21,23 @@ from aider.versioncheck import check_version, install_from_main_branch, install_
from .dump import dump # noqa: F401
def setup_git_home(io):
home = Path.home()
git_repos = list(home.glob("*/.git"))
if git_repos:
io.tool_output("Found existing Git repositories in your home directory:")
for i, repo in enumerate(git_repos, 1):
io.tool_output(f"{i}. {repo.parent.name}")
choice = io.user_input("Enter the number of the repository you want to work on, or 'n' for a new project: ")
choice = io.user_input(
"Enter the number of the repository you want to work on, or 'n' for a new project: "
)
if choice.isdigit() and 1 <= int(choice) <= len(git_repos):
return str(git_repos[int(choice) - 1].parent)
project_name = io.user_input("Enter a name for your new project: ")
new_dir = home / project_name
new_dir.mkdir(exist_ok=True)
@ -77,7 +80,9 @@ def setup_git(git_root, io):
cwd = Path.cwd()
if cwd == Path.home():
git_root = setup_git_home(io)
elif io.confirm_ask("No git repo found, create one to track aider's changes (recommended)?"):
elif io.confirm_ask(
"No git repo found, create one to track aider's changes (recommended)?"
):
git_root = str(cwd.resolve())
repo = git.Repo.init(git_root)
io.tool_output("Git repository created in the current working directory.")