aider: Added --verbose option to enable verbose output.

# Context:
USER: Add --verbose with no env default. pass into Coder and set self.verbose
ASSISTANT: To add the `--verbose` option, we need to modify the `aider/main.py` file. Here's the step-by-step process:

1. Add the `--verbose` argument to the `argparse.ArgumentParser` in the `main` function.
2. Pass the `args.verbose` value to the `Coder` class when initializing it.
3. Update the `Coder` class in the `aider/coder.py` file to accept the `verbose` parameter and set `self.verbose`.

Here are the changes to the code:

```python
aider/main.py
<<<<<<< ORIGINAL
    parser.add_argument(
        "--yes",
        action="store_true",
        help="Always say yes to every confirmation",
        default=False,
    )
=======
    parser.add_argument(
        "--yes",
        action="store_true",
        help="Always say yes to every confirmation",
        default=False,
    )
    parser.add_argument(
        "--verbose",
        action="store_true",
        help="Enable verbose output",
        default=False,
    )
>>>>>>> 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,
    )
=======
    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,
    )
>>>>>>> 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,
    ):
=======
    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
>>>>>>> UPDATED
```
This commit is contained in:
Paul Gauthier 2023-05-19 10:55:48 -07:00
parent 7d2c59432e
commit 10e38e1fe9
2 changed files with 9 additions and 0 deletions

View file

@ -39,7 +39,9 @@ class Coder:
auto_commits=True,
dry_run=False,
use_ctags=False,
verbose=False,
):
self.verbose = verbose
self.use_ctags = use_ctags
self.abs_fnames = set()
self.cur_messages = []

View file

@ -96,6 +96,12 @@ def main(args=None, input=None, output=None):
help="Always say yes to every confirmation",
default=False,
)
parser.add_argument(
"--verbose",
action="store_true",
help="Enable verbose output",
default=False,
)
args = parser.parse_args(args)
io = InputOutput(
@ -118,6 +124,7 @@ def main(args=None, input=None, output=None):
auto_commits=args.auto_commits,
dry_run=args.dry_run,
use_ctags=args.ctags,
verbose=args.verbose,
)
if args.auto_commits:
coder.commit(ask=True, prefix="wip: ", which="repo_files")