mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
refac
This commit is contained in:
parent
a7aa95b18c
commit
6b5c93f046
1 changed files with 16 additions and 14 deletions
|
@ -6,6 +6,14 @@ from dotenv import load_dotenv
|
|||
from aider.coder import Coder
|
||||
from aider.io import InputOutput
|
||||
|
||||
def get_git_root():
|
||||
try:
|
||||
repo = git.Repo(search_parent_directories=True)
|
||||
return repo.working_tree_dir
|
||||
except git.InvalidGitRepositoryError:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
def main(args=None, input=None, output=None):
|
||||
if args is None:
|
||||
|
@ -14,26 +22,20 @@ def main(args=None, input=None, output=None):
|
|||
load_dotenv()
|
||||
env_prefix = "AIDER_"
|
||||
|
||||
def get_git_root():
|
||||
try:
|
||||
repo = git.Repo(search_parent_directories=True)
|
||||
return repo.working_tree_dir
|
||||
except git.InvalidGitRepositoryError:
|
||||
return None
|
||||
git_root = get_git_root()
|
||||
if git_root:
|
||||
default_config_files.insert(0, os.path.join(git_root, ".aider.conf.yml"))
|
||||
|
||||
default_config_files = [
|
||||
os.path.expanduser("~/.aider.conf.yml"),
|
||||
]
|
||||
|
||||
git_root = get_git_root()
|
||||
if git_root:
|
||||
default_config_files.insert(0, os.path.join(git_root, ".aider.conf.yml"))
|
||||
parser = configargparse.ArgumentParser(
|
||||
description="aider - chat with GPT about your code",
|
||||
add_config_file_help=True,
|
||||
default_config_files=default_config_files,
|
||||
)
|
||||
|
||||
parser = configargparse.ArgumentParser(
|
||||
description="aider - chat with GPT about your code",
|
||||
add_config_file_help=True,
|
||||
default_config_files=default_config_files,
|
||||
)
|
||||
parser.add_argument(
|
||||
"files",
|
||||
metavar="FILE",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue