mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
![]() # Context: USER: add a new arg --yes without env. pass it to Coder and store in self.yes. "Always say yes to every confirmation" ASSISTANT: To add a new argument `--yes` and pass it to the `Coder` class, we need to make changes in `aider/main.py` and `aider/coder.py`. In `aider/main.py`, add the new argument `--yes` to the argument parser and pass it to the `Coder` class. ```python aider/main.py <<<<<<< ORIGINAL parser.add_argument( "--show-diffs", action="store_true", help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)", default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))), ) ======= parser.add_argument( "--show-diffs", action="store_true", help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)", default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))), ) parser.add_argument( "--yes", action="store_true", help="Always say yes to every confirmation", ) >>>>>>> UPDATED ``` ```python aider/main.py <<<<<<< ORIGINAL coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs, args.auto_commits) ======= coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs, args.auto_commits, args.yes) >>>>>>> UPDATED ``` In `aider/coder.py`, add the `yes` parameter to the `Coder` class and store it in `self.yes`. ```python aider/coder.py <<<<<<< ORIGINAL def __init__(self, main_model, fnames, pretty, history_file, show_diffs, auto_commits): ======= def __init__(self, main_model, fnames, pretty, history_file, show_diffs, auto_commits, yes): >>>>>>> UPDATED ``` ```python aider/coder.py <<<<<<< ORIGINAL self.show_diffs = show_diffs ======= self.show_diffs = show_diffs self.yes = yes >>>>>>> UPDATED ``` Now, the `--yes` argument is added and passed to the `Coder` class. You can use `self.yes` in the `Coder` class to determine if the user wants to always say yes to every confirmation. |
||
---|---|---|
.. | ||
__init__.py | ||
coder.py | ||
commands.py | ||
dump.py | ||
getinput.py | ||
main.py | ||
prompts.py | ||
utils.py |