From 3f2dfa24eea899a87f8212646abefa61042a0e65 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 18 Oct 2023 12:44:11 -0700 Subject: [PATCH] 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. --- aider/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aider/main.py b/aider/main.py index f3461dd6e..2ace2532b 100644 --- a/aider/main.py +++ b/aider/main.py @@ -332,6 +332,12 @@ def main(argv=None, input=None, output=None, force_git_root=None): 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")