mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 22:04:59 +00:00
aider: Added a new argument --yes
to always say yes to every confirmation and passed it to the Coder
class.
# 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.
This commit is contained in:
parent
09fbbc0dae
commit
0dd35cdaee
2 changed files with 8 additions and 2 deletions
|
@ -33,7 +33,7 @@ class Coder:
|
|||
repo = None
|
||||
last_aider_commit_hash = None
|
||||
|
||||
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):
|
||||
self.history_file = history_file
|
||||
self.auto_commits = auto_commits
|
||||
|
||||
|
@ -57,6 +57,7 @@ class Coder:
|
|||
|
||||
self.pretty = pretty
|
||||
self.show_diffs = show_diffs
|
||||
self.yes = yes
|
||||
|
||||
def find_common_root(self):
|
||||
if self.abs_fnames:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue