aider: Added auto_commits as a new argument to the Coder() class and updated main() function to pass the argument.

# Context:
USER: add auto_commits as a new arg to Coder(). assign it to self.auto_commit
ASSISTANT: To add `auto_commits` as a new argument to the `Coder()` class and assign it to `self.auto_commit`, you need to update the `__init__` method in the `aider/coder.py` file:

```python
aider/coder.py
<<<<<<< ORIGINAL
    def __init__(self, main_model, fnames, pretty, history_file, show_diffs):
=======
    def __init__(self, main_model, fnames, pretty, history_file, show_diffs, auto_commits):
>>>>>>> UPDATED
        self.history_file = history_file

        # ... (rest of the code remains unchanged)

        self.show_diffs = show_diffs
<<<<<<< ORIGINAL
=======
        self.auto_commit = auto_commits
>>>>>>> UPDATED
```

Then, update the `main()` function in the `aider/main.py` file to pass the `auto_commits` argument when creating a new `Coder` instance:

```python
aider/main.py
<<<<<<< ORIGINAL
    coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs)
=======
    coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs, args.auto_commits)
>>>>>>> UPDATED
    coder.commit(ask=True, prefix="wip: ", which="repo_files")

    # ... (rest of the code remains unchanged)
```
This commit is contained in:
Paul Gauthier 2023-05-11 15:45:31 -07:00
parent 8bcbc5b0de
commit b018eade37
2 changed files with 2 additions and 2 deletions

View file

@ -33,7 +33,7 @@ class Coder:
repo = None
last_aider_commit_hash = None
def __init__(self, main_model, fnames, pretty, history_file, show_diffs):
def __init__(self, main_model, fnames, pretty, history_file, show_diffs, auto_commits):
self.history_file = history_file
if pretty: