From b706c36565bf4d2c2d88f3f158a9f5f863bc2b81 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 26 May 2023 16:23:47 -0700 Subject: [PATCH] aider: Added --config/-c option to specify the config file and updated the configargparse.ArgumentParser to use the YAMLConfigFileParser. # Context: USER: add --config/-c to specify the config file ASSISTANT: To add the `--config/-c` option to specify the config file, you need to modify the `aider/main.py` file. Update the `configargparse.ArgumentParser` arguments and add a new argument for the `--config/-c` option. Here's the change: ```python aider/main.py <<<<<<< ORIGINAL 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, config_file_parser_class=configargparse.YAMLConfigFileParser, ) parser.add_argument( "-c", "--config", is_config_file=True, metavar="CONFIG_FILE", help="Specify the config file (default: search for .aider.conf.yml in git root or home directory)", ) >>>>>>> UPDATED ``` This change adds the `--config/-c` option to specify the config file and updates the `configargparse.ArgumentParser` to use the YAMLConfigFileParser for parsing the config file. --- aider/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aider/main.py b/aider/main.py index 69a598d21..e8a7a794f 100644 --- a/aider/main.py +++ b/aider/main.py @@ -33,6 +33,15 @@ def main(args=None, input=None, output=None): description="aider - chat with GPT about your code", add_config_file_help=True, default_config_files=default_config_files, + config_file_parser_class=configargparse.YAMLConfigFileParser, + ) + + parser.add_argument( + "-c", + "--config", + is_config_file=True, + metavar="CONFIG_FILE", + help="Specify the config file (default: search for .aider.conf.yml in git root or home directory)", ) parser.add_argument(