mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
refac
This commit is contained in:
parent
95a4ed47e6
commit
9b60243932
1 changed files with 12 additions and 17 deletions
|
@ -28,12 +28,22 @@ def get_preparser(default_config_files, git_root):
|
||||||
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
||||||
auto_env_var_prefix="AIDER_",
|
auto_env_var_prefix="AIDER_",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_env_file(parser, git_root)
|
||||||
|
add_config_option(parser)
|
||||||
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def add_env_file(parser, git_root):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--env-file",
|
"--env-file",
|
||||||
metavar="ENV_FILE",
|
metavar="ENV_FILE",
|
||||||
default=default_env_file(git_root),
|
default=default_env_file(git_root),
|
||||||
help="Specify the .env file to load (default: .env in git root)",
|
help="Specify the .env file to load (default: .env in git root)",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def add_config_option(parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c",
|
"-c",
|
||||||
"--config",
|
"--config",
|
||||||
|
@ -44,7 +54,6 @@ def get_preparser(default_config_files, git_root):
|
||||||
" or home directory)"
|
" or home directory)"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return parser
|
|
||||||
|
|
||||||
|
|
||||||
def get_parser(default_config_files, git_root):
|
def get_parser(default_config_files, git_root):
|
||||||
|
@ -230,12 +239,7 @@ def get_parser(default_config_files, git_root):
|
||||||
)
|
)
|
||||||
# This is a duplicate of the argument in the preparser and is a no-op by this time of
|
# This is a duplicate of the argument in the preparser and is a no-op by this time of
|
||||||
# argument parsing, but it's here so that the help is displayed as expected.
|
# argument parsing, but it's here so that the help is displayed as expected.
|
||||||
group.add_argument(
|
add_env_file(group, git_root)
|
||||||
"--env-file",
|
|
||||||
metavar="ENV_FILE",
|
|
||||||
default=default_env_file(git_root),
|
|
||||||
help="Specify the .env file to load (default: .env in git root)",
|
|
||||||
)
|
|
||||||
|
|
||||||
##########
|
##########
|
||||||
group = parser.add_argument_group("History Files")
|
group = parser.add_argument_group("History Files")
|
||||||
|
@ -509,16 +513,7 @@ def get_parser(default_config_files, git_root):
|
||||||
default="utf-8",
|
default="utf-8",
|
||||||
help="Specify the encoding for input and output (default: utf-8)",
|
help="Specify the encoding for input and output (default: utf-8)",
|
||||||
)
|
)
|
||||||
group.add_argument(
|
add_config_option(group)
|
||||||
"-c",
|
|
||||||
"--config",
|
|
||||||
is_config_file=True,
|
|
||||||
metavar="CONFIG_FILE",
|
|
||||||
help=(
|
|
||||||
"Specify the config file (default: search for .aider.conf.yml in git root, cwd"
|
|
||||||
" or home directory)"
|
|
||||||
),
|
|
||||||
)
|
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"--gui",
|
"--gui",
|
||||||
"--browser",
|
"--browser",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue