From 6f453e2ac1fc64061044601ac0acdde3ab1e6815 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 18 Oct 2023 10:17:44 -0700 Subject: [PATCH] aider: Add a switch for an aider ignore file, which defaults to .aiderignore in the root of the git repo. # Aider chat conversation: USER: add a switch for an aider ignore file, which should default to .aiderignore in the root of the git repo ASSISTANT: To add a switch for an aider ignore file, we need to modify the `aider/main.py` file. We will add a new argument to the `argparse.ArgumentParser` instance to accept the path of the aider ignore file. The default value will be `.aiderignore` in the root of the git repo. Here is the *edit block* for the change: ```python aider/main.py <<<<<<< HEAD ########## git_group = parser.add_argument_group("Git Settings") git_group.add_argument( "--git", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable looking for a git repo (default: True)", ) git_group.add_argument( "--gitignore", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable adding .aider* to .gitignore (default: True)", ) git_group.add_argument( "--auto-commits", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable auto commit of GPT changes (default: True)", ) git_group.add_argument( "--dirty-commits", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable commits when repo is found dirty (default: True)", ) git_group.add_argument( "--dry-run", action=argparse.BooleanOptionalAction, default=False, help="Enable/disable performing a dry run without modifying files (default: False)", ) ======= ########## git_group = parser.add_argument_group("Git Settings") git_group.add_argument( "--git", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable looking for a git repo (default: True)", ) git_group.add_argument( "--gitignore", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable adding .aider* to .gitignore (default: True)", ) git_group.add_argument( "--aiderignore", metavar="AIDERIGNORE", default=".aiderignore", help="Specify the aider ignore file (default: .aiderignore in git root)", ) git_group.add_argument( "--auto-commits", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable auto commit of GPT changes (default: True)", ) git_group.add_argument( "--dirty-commits", action=argparse.BooleanOptionalAction, default=True, help="Enable/disable commits when repo is found dirty (default: True)", ) git_group.add_argument( "--dry-run", action=argparse.BooleanOptionalAction, default=False, help="Enable/disable performing a dry run without modifying files (default: False)", ) >>>>>>> updated ``` This change adds a new command-line argument `--aiderignore` that allows the user to specify the path of the aider ignore file. The default value is `.aiderignore`, which will be located in the root of the git repo. --- aider/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aider/main.py b/aider/main.py index 10849fc7d..620e17ace 100644 --- a/aider/main.py +++ b/aider/main.py @@ -305,6 +305,12 @@ def main(argv=None, input=None, output=None, force_git_root=None): default=True, help="Enable/disable adding .aider* to .gitignore (default: True)", ) + git_group.add_argument( + "--aiderignore", + metavar="AIDERIGNORE", + default=".aiderignore", + help="Specify the aider ignore file (default: .aiderignore in git root)", + ) git_group.add_argument( "--auto-commits", action=argparse.BooleanOptionalAction,