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.
This commit is contained in:
Paul Gauthier 2023-10-18 10:17:44 -07:00
parent bf154b548e
commit 6f453e2ac1

View file

@ -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,