aider: Added --no-dirty-commits argument to the argument parser in aider/main.py, passed it to the Coder class, and set the self.dirty_commits attribute in the Coder class in aider/coder.py.

# Context:
USER: add a new arg like --no-auto-commits, but called --no-dirty-commits. pass it to Coder and set self.dirty_commits
ASSISTANT: To add the `--no-dirty-commits` argument, we need to modify the `aider/main.py` file and pass the new argument to the `Coder` class in the `aider/coder.py` file.

Here are the changes:

```python
aider/main.py
<<<<<<< ORIGINAL
    parser.add_argument(
        "--no-auto-commits",
        action="store_false",
        dest="auto_commits",
        help="Disable auto commit of changes",
    )
=======
    parser.add_argument(
        "--no-auto-commits",
        action="store_false",
        dest="auto_commits",
        help="Disable auto commit of changes",
    )
    parser.add_argument(
        "--no-dirty-commits",
        action="store_false",
        dest="dirty_commits",
        help="Disable dirty commit of changes",
    )
>>>>>>> UPDATED
```

```python
aider/main.py
<<<<<<< ORIGINAL
    coder = Coder(
        io,
        main_model=args.model,
        fnames=args.files,
        pretty=args.pretty,
        show_diffs=args.show_diffs,
        auto_commits=args.auto_commits,
        dry_run=args.dry_run,
        use_ctags=args.ctags,
        verbose=args.verbose,
    )
=======
    coder = Coder(
        io,
        main_model=args.model,
        fnames=args.files,
        pretty=args.pretty,
        show_diffs=args.show_diffs,
        auto_commits=args.auto_commits,
        dirty_commits=args.dirty_commits,
        dry_run=args.dry_run,
        use_ctags=args.ctags,
        verbose=args.verbose,
    )
>>>>>>> UPDATED
```

```python
aider/coder.py
<<<<<<< ORIGINAL
    def __init__(
        self,
        io,
        main_model="gpt-4",
        fnames=None,
        pretty=True,
        show_diffs=False,
        auto_commits=True,
        dry_run=False,
        use_ctags=False,
        verbose=False,
    ):
        self.verbose = verbose
        self.abs_fnames = set()
        self.cur_messages = []
        self.done_messages = []

        self.io = io
        self.auto_commits = auto_commits
        self.dry_run = dry_run
=======
    def __init__(
        self,
        io,
        main_model="gpt-4",
        fnames=None,
        pretty=True,
        show_diffs=False,
        auto_commits=True,
        dirty_commits=True,
        dry_run=False,
        use_ctags=False,
        verbose=False,
    ):
        self.verbose = verbose
        self.abs_fnames = set()
        self.cur_messages = []
        self.done_messages = []

        self.io = io
        self.auto_commits = auto_commits
        self.dirty_commits = dirty_commits
        self.dry_run = dry_run
>>>>>>> UPDATED
```

These changes add the `--no-dirty-commits` argument to the argument parser in `aider/main.py`, pass it to the `Coder` class, and set the `self.dirty_commits` attribute in the `Coder` class in `aider/coder.py`.
This commit is contained in:
Paul Gauthier 2023-05-27 05:09:28 -07:00
parent a24e150e49
commit ed1a886a4f
2 changed files with 9 additions and 0 deletions

View file

@ -122,6 +122,12 @@ def main(args=None, input=None, output=None):
dest="auto_commits",
help="Disable auto commit of changes",
)
parser.add_argument(
"--no-dirty-commits",
action="store_false",
dest="dirty_commits",
help="Disable dirty commit of changes",
)
parser.add_argument(
"--dry-run",
action="store_true",
@ -187,6 +193,7 @@ def main(args=None, input=None, output=None):
pretty=args.pretty,
show_diffs=args.show_diffs,
auto_commits=args.auto_commits,
dirty_commits=args.dirty_commits,
dry_run=args.dry_run,
use_ctags=args.ctags,
verbose=args.verbose,