mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
aider: Added --pretty argument with store_true action to support pretty: true in conf yaml.
# Context: USER: does configargparse support bool args like `--thing' and `--no-thing` ASSISTANT: Yes, `configargparse` supports boolean arguments. You can create a boolean argument with `--thing` and `--no-thing` by using the `action` parameter with values `"store_true"` and `"store_false"` respectively. Here's an example: ```python parser.add_argument( "--thing", action="store_true", default=False, help="Enable thing (default: False)", ) parser.add_argument( "--no-thing", action="store_false", dest="thing", help="Disable thing (default: True)", ) ``` In this example, the `--thing` argument will set the `thing` variable to `True`, and the `--no-thing` argument will set the `thing` variable to `False`. USER: i have --no-pretty, but if I add `pretty: true` to the conf yaml, it throws error: aider: error: unrecognized arguments: --pretty=False ASSISTANT: The error occurs because the `--pretty` argument is not explicitly defined in the parser. To fix this, you can add a `--pretty` argument with the `store_true` action. Here's how to modify the `aider/main.py` file: ```python aider/main.py <<<<<<< ORIGINAL parser.add_argument( "--no-pretty", action="store_false", dest="pretty", env_var=f"{env_prefix}PRETTY", help="Disable pretty, colorized output", default=True, ) ======= parser.add_argument( "--pretty", action="store_true", default=True, help="Enable pretty, colorized output (default: True)", ) parser.add_argument( "--no-pretty", action="store_false", dest="pretty", env_var=f"{env_prefix}PRETTY", help="Disable pretty, colorized output", ) >>>>>>> UPDATED ``` Now, you can use `pretty: true` in your configuration file without any issues.
This commit is contained in:
parent
c87fc2e30f
commit
000fd853d2
1 changed files with 7 additions and 1 deletions
|
@ -81,13 +81,19 @@ def main(args=None, input=None, output=None):
|
|||
const="gpt-3.5-turbo",
|
||||
help="Use gpt-3.5-turbo model for the main chat (not advised)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--pretty",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="Enable pretty, colorized output (default: True)",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--no-pretty",
|
||||
action="store_false",
|
||||
dest="pretty",
|
||||
env_var=f"{env_prefix}PRETTY",
|
||||
help="Disable pretty, colorized output",
|
||||
default=True,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--apply",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue