From 37741bed2a20f151faf27d7d8c3cbc9b70442ef8 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 May 2023 15:43:18 -0700 Subject: [PATCH] aider: Reversed the logic of the --no-auto-commits variable, storing to an "auto_commits" var with default value of True, and updated the environment variable to AUTO_COMMITS in aider/main.py. # Context: USER: reverse the logic of the --no-aut-commits variable, so it's storing to an "auto_commits" var. default is true. env is AUTO_COMMITS. but keep the switch as --no-auto-commits ASSISTANT: To reverse the logic of the `--no-auto-commits` variable, we need to change the variable name to `auto_commits`, set its default value to `True`, and update the environment variable to `AUTO_COMMITS`. Please provide the contents of the file where this variable is defined, so I can suggest the necessary changes. USER: Please note that I shared content of these additional files: aider/main.py ASSISTANT: I apologize for the oversight. Here are the changes to reverse the logic of the `--no-auto-commits` variable in the `aider/main.py` file: ```python aider/main.py <<<<<<< ORIGINAL parser.add_argument( "--no-auto-commits", action="store_true", help=f"Do not automatically commit changes (default: False, ${env_prefix}NO_AUTO_COMMITS)", default=bool(int(os.environ.get(f"{env_prefix}NO_AUTO_COMMITS", 0))), ) ======= parser.add_argument( "--no-auto-commits", action="store_false", dest="auto_commits", help=f"Do not automatically commit changes (default: True, ${env_prefix}AUTO_COMMITS)", default=bool(int(os.environ.get(f"{env_prefix}AUTO_COMMITS", 1))), ) >>>>>>> UPDATED ``` This change will store the value of the `--no-auto-commits` flag in the `auto_commits` variable, with a default value of `True`. The environment variable is also updated to `AUTO_COMMITS`. --- aider/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aider/main.py b/aider/main.py index fb209d6d4..97b595fbd 100644 --- a/aider/main.py +++ b/aider/main.py @@ -50,9 +50,10 @@ def main(): ) parser.add_argument( "--no-auto-commits", - action="store_true", - help=f"Do not automatically commit changes (default: False, ${env_prefix}NO_AUTO_COMMITS)", - default=bool(int(os.environ.get(f"{env_prefix}NO_AUTO_COMMITS", 0))), + action="store_false", + dest="auto_commits", + help=f"Do not automatically commit changes (default: True, ${env_prefix}AUTO_COMMITS)", + default=bool(int(os.environ.get(f"{env_prefix}AUTO_COMMITS", 1))), ) parser.add_argument( "--show-diffs",