aider: Added a --no-auto-commits argument and an environment variable.

# Context:
USER: add a --no-auto-commits arg and env var "Do not automatically commit changes"
ASSISTANT: To add a `--no-auto-commits` argument and an environment variable, we will update the `aider/main.py` file. We will add a new argument to the `argparse.ArgumentParser` and use the environment variable to set its default value.

```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(
        "--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(
        "--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))),
    )
>>>>>>> UPDATED
```

Now, you can use the `--no-auto-commits` argument when running the script, and it will also read the `AIDER_NO_AUTO_COMMITS` environment variable to set its default value.
This commit is contained in:
Paul Gauthier 2023-05-11 15:41:09 -07:00
parent b83ef2f30f
commit a6d9581e5f

View file

@ -48,6 +48,12 @@ def main():
metavar="FILE",
help="Apply the changes from the given file instead of running the chat (debug)",
)
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(
"--show-diffs",
action="store_true",