aider: Add a --commit arg that commits all pending changes with a suitable commit message.

# Aider chat conversation:

USER: Add a --commit arg that will commit all pending changes with a suitable commit message

ASSISTANT: To add a `--commit` argument, we need to modify the `aider/main.py` file. Specifically, we will add a new argument to the `git_group` argument group in the `main` function.

Here is the proposed change:

```python
aider/main.py
<<<<<<< HEAD
    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.add_argument(
        "--dry-run",
        action=argparse.BooleanOptionalAction,
        default=False,
        help="Enable/disable performing a dry run without modifying files (default: False)",
    )
    git_group.add_argument(
        "--commit",
        action="store_true",
        help="Commit all pending changes with a suitable commit message",
        default=False,
    )
>>>>>>> updated
```

This change adds a new `--commit` argument that, when used, will trigger the commit of all pending changes. The default value is `False`, meaning that if the argument is not provided, no commit will be made. The help text provides a brief explanation of what the argument does.

After adding this argument, you will need to implement the functionality to commit changes when this argument is used. This will likely involve modifying the `GitRepo` class in the `aider/repo.py` file, but since that file is read-only, I can't provide the specific changes here.
This commit is contained in:
Paul Gauthier 2023-10-18 12:44:11 -07:00
parent 5756812938
commit 3f2dfa24ee

View file

@ -332,6 +332,12 @@ def main(argv=None, input=None, output=None, force_git_root=None):
default=False, default=False,
help="Enable/disable performing a dry run without modifying files (default: False)", help="Enable/disable performing a dry run without modifying files (default: False)",
) )
git_group.add_argument(
"--commit",
action="store_true",
help="Commit all pending changes with a suitable commit message",
default=False,
)
########## ##########
other_group = parser.add_argument_group("Other Settings") other_group = parser.add_argument_group("Other Settings")