From 53deb04e75e1b6b236c912d00579f7bdb418ba20 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 6 Jun 2024 13:46:32 -0700 Subject: [PATCH] use dashed-names not underscore_names in yaml --- aider/args_formatter.py | 13 +++- website/assets/sample.aider.conf.yml | 103 +++++++++++++-------------- website/docs/aider_conf.md | 103 +++++++++++++-------------- 3 files changed, 110 insertions(+), 109 deletions(-) diff --git a/aider/args_formatter.py b/aider/args_formatter.py index 18288ea08..9ad00ff66 100644 --- a/aider/args_formatter.py +++ b/aider/args_formatter.py @@ -23,6 +23,9 @@ class YamlHelpFormatter(argparse.HelpFormatter): """ def _format_action(self, action): + if not action.option_strings: + return "" + parts = [""] metavar = action.metavar @@ -44,18 +47,22 @@ class YamlHelpFormatter(argparse.HelpFormatter): if action.help: parts.append(f"## {action.help}") - switch = action.dest + for switch in action.option_strings: + if switch.startswith("--"): + break + switch = switch.lstrip("-") + if isinstance(action, argparse._StoreTrueAction): default = False elif isinstance(action, argparse._StoreConstAction): - default = action.const + default = False if default is False: default = "false" if default is True: default = "true" - if default is not None: + if default: parts.append(f"#{switch}: {default}\n") else: parts.append(f"#{switch}:\n") diff --git a/website/assets/sample.aider.conf.yml b/website/assets/sample.aider.conf.yml index 52d9c2fd6..3577657b8 100644 --- a/website/assets/sample.aider.conf.yml +++ b/website/assets/sample.aider.conf.yml @@ -7,100 +7,97 @@ # options: ## show this help message and exit -#help: +#help: ####### # Main: -## files to edit with an LLM (optional) -#files: +## Specify the OpenAI API key +#openai-api-key: ## Specify the OpenAI API key -#openai_api_key: - -## Specify the OpenAI API key -#anthropic_api_key: +#anthropic-api-key: ## Specify the model to use for the main chat (default: gpt-4o) #model: gpt-4o ## Use claude-3-opus-20240229 model for the main chat -#model: claude-3-opus-20240229 +#opus: false ## Use claude-3-sonnet-20240229 model for the main chat -#model: claude-3-sonnet-20240229 +#sonnet: false ## Use gpt-4-0613 model for the main chat -#model: gpt-4-0613 +#4: false ## Use gpt-4o model for the main chat -#model: gpt-4o +#4o: false ## Use gpt-4-1106-preview model for the main chat -#model: gpt-4-1106-preview +#4-turbo: false ## Use gpt-3.5-turbo model for the main chat -#model: gpt-3.5-turbo +#35turbo: false ################# # Model Settings: ## List known models which match the (partial) MODEL name -#models: +#models: ## Specify the api base url -#openai_api_base: +#openai-api-base: ## Specify the api_type -#openai_api_type: +#openai-api-type: ## Specify the api_version -#openai_api_version: +#openai-api-version: ## Specify the deployment_id -#openai_api_deployment_id: +#openai-api-deployment-id: ## Specify the OpenAI organization ID -#openai_organization_id: +#openai-organization-id: ## Specify what edit format the LLM should use (default depends on model) -#edit_format: +#edit-format: ## Specify the model to use for commit messages and chat history summarization (default depends on --model) -#weak_model: +#weak-model: ## Only work with models that have meta-data available (default: True) -#show_model_warnings: true +#show-model-warnings: true ## Max number of tokens to use for repo map, use 0 to disable (default: 1024) -#map_tokens: true +#map-tokens: true ## Maximum number of tokens to use for chat history. If not specified, uses the model's max_chat_history_tokens. -#max_chat_history_tokens: +#max-chat-history-tokens: ## Specify the .env file to load (default: .env in git root) -#env_file: .env +#env-file: .env ################ # History Files: ## Specify the chat input history file (default: .aider.input.history) -#input_history_file: .aider.input.history +#input-history-file: .aider.input.history ## Specify the chat history file (default: .aider.chat.history.md) -#chat_history_file: .aider.chat.history.md +#chat-history-file: .aider.chat.history.md ## Restore the previous chat history messages (default: False) -#restore_chat_history: false +#restore-chat-history: false ################## # Output Settings: ## Use colors suitable for a dark terminal background (default: False) -#dark_mode: false +#dark-mode: false ## Use colors suitable for a light terminal background (default: False) -#light_mode: false +#light-mode: false ## Enable/disable pretty, colorized output (default: True) #pretty: true @@ -109,22 +106,22 @@ #stream: true ## Set the color for user input (default: #00cc00) -#user_input_color: #00cc00 +#user-input-color: #00cc00 ## Set the color for tool output (default: None) -#tool_output_color: +#tool-output-color: ## Set the color for tool error messages (default: red) -#tool_error_color: #FF2222 +#tool-error-color: #FF2222 ## Set the color for assistant output (default: #0088ff) -#assistant_output_color: #0088ff +#assistant-output-color: #0088ff ## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light) -#code_theme: default +#code-theme: default ## Show diffs when committing changes (default: False) -#show_diffs: false +#show-diffs: false ############### # Git Settings: @@ -139,13 +136,13 @@ #aiderignore: .aiderignore ## Enable/disable auto commit of LLM changes (default: True) -#auto_commits: true +#auto-commits: true ## Enable/disable commits when repo is found dirty (default: True) -#dirty_commits: true +#dirty-commits: true ## Perform a dry run without modifying files (default: False) -#dry_run: false +#dry-run: false ######################## # Fixing and committing: @@ -157,16 +154,16 @@ #lint: false ## Specify lint commands to run for different languages, eg: "python: flake8 --select=..." (can be used multiple times) -#lint_cmd: +#lint-cmd: ## Enable/disable automatic linting after changes (default: True) -#auto_lint: true +#auto-lint: true ## Specify command to run tests -#test_cmd: +#test-cmd: ## Enable/disable automatic testing after changes (default: False) -#auto_test: false +#auto-test: false ## Run tests and fix problems found #test: false @@ -175,19 +172,19 @@ # Other Settings: ## Specify the language for voice using ISO 639-1 code (default: auto) -#voice_language: en +#voice-language: en ## Show the version number and exit -#version: +#version: ## Check for updates and return status in the exit code -#check_update: false +#check-update: false ## Skips checking for the update when the program runs -#skip_check_update: false +#skip-check-update: false ## Apply the changes from the given file instead of running the chat (debug) -#apply: +#apply: ## Always say yes to every confirmation #yes: false @@ -196,22 +193,22 @@ #verbose: false ## Print the repo map and exit (debug) -#show_repo_map: false +#show-repo-map: false ## Print the system prompts and exit (debug) -#show_prompts: false +#show-prompts: false ## Specify a single message to send the LLM, process reply then exit (disables chat mode) -#message: +#message: ## Specify a file containing the message to send the LLM, process reply, then exit (disables chat mode) -#message_file: +#message-file: ## Specify the encoding for input and output (default: utf-8) #encoding: utf-8 ## Specify the config file (default: search for .aider.conf.yml in git root, cwd or home directory) -#config: +#config: ## Run aider in your browser #gui: false diff --git a/website/docs/aider_conf.md b/website/docs/aider_conf.md index f21d2fbbd..e0f80b5a6 100644 --- a/website/docs/aider_conf.md +++ b/website/docs/aider_conf.md @@ -32,100 +32,97 @@ cog.outl("```") # options: ## show this help message and exit -#help: +#help: ####### # Main: -## files to edit with an LLM (optional) -#files: +## Specify the OpenAI API key +#openai-api-key: ## Specify the OpenAI API key -#openai_api_key: - -## Specify the OpenAI API key -#anthropic_api_key: +#anthropic-api-key: ## Specify the model to use for the main chat (default: gpt-4o) #model: gpt-4o ## Use claude-3-opus-20240229 model for the main chat -#model: claude-3-opus-20240229 +#opus: false ## Use claude-3-sonnet-20240229 model for the main chat -#model: claude-3-sonnet-20240229 +#sonnet: false ## Use gpt-4-0613 model for the main chat -#model: gpt-4-0613 +#4: false ## Use gpt-4o model for the main chat -#model: gpt-4o +#4o: false ## Use gpt-4-1106-preview model for the main chat -#model: gpt-4-1106-preview +#4-turbo: false ## Use gpt-3.5-turbo model for the main chat -#model: gpt-3.5-turbo +#35turbo: false ################# # Model Settings: ## List known models which match the (partial) MODEL name -#models: +#models: ## Specify the api base url -#openai_api_base: +#openai-api-base: ## Specify the api_type -#openai_api_type: +#openai-api-type: ## Specify the api_version -#openai_api_version: +#openai-api-version: ## Specify the deployment_id -#openai_api_deployment_id: +#openai-api-deployment-id: ## Specify the OpenAI organization ID -#openai_organization_id: +#openai-organization-id: ## Specify what edit format the LLM should use (default depends on model) -#edit_format: +#edit-format: ## Specify the model to use for commit messages and chat history summarization (default depends on --model) -#weak_model: +#weak-model: ## Only work with models that have meta-data available (default: True) -#show_model_warnings: true +#show-model-warnings: true ## Max number of tokens to use for repo map, use 0 to disable (default: 1024) -#map_tokens: true +#map-tokens: true ## Maximum number of tokens to use for chat history. If not specified, uses the model's max_chat_history_tokens. -#max_chat_history_tokens: +#max-chat-history-tokens: ## Specify the .env file to load (default: .env in git root) -#env_file: .env +#env-file: .env ################ # History Files: ## Specify the chat input history file (default: .aider.input.history) -#input_history_file: .aider.input.history +#input-history-file: .aider.input.history ## Specify the chat history file (default: .aider.chat.history.md) -#chat_history_file: .aider.chat.history.md +#chat-history-file: .aider.chat.history.md ## Restore the previous chat history messages (default: False) -#restore_chat_history: false +#restore-chat-history: false ################## # Output Settings: ## Use colors suitable for a dark terminal background (default: False) -#dark_mode: false +#dark-mode: false ## Use colors suitable for a light terminal background (default: False) -#light_mode: false +#light-mode: false ## Enable/disable pretty, colorized output (default: True) #pretty: true @@ -134,22 +131,22 @@ cog.outl("```") #stream: true ## Set the color for user input (default: #00cc00) -#user_input_color: #00cc00 +#user-input-color: #00cc00 ## Set the color for tool output (default: None) -#tool_output_color: +#tool-output-color: ## Set the color for tool error messages (default: red) -#tool_error_color: #FF2222 +#tool-error-color: #FF2222 ## Set the color for assistant output (default: #0088ff) -#assistant_output_color: #0088ff +#assistant-output-color: #0088ff ## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light) -#code_theme: default +#code-theme: default ## Show diffs when committing changes (default: False) -#show_diffs: false +#show-diffs: false ############### # Git Settings: @@ -164,13 +161,13 @@ cog.outl("```") #aiderignore: .aiderignore ## Enable/disable auto commit of LLM changes (default: True) -#auto_commits: true +#auto-commits: true ## Enable/disable commits when repo is found dirty (default: True) -#dirty_commits: true +#dirty-commits: true ## Perform a dry run without modifying files (default: False) -#dry_run: false +#dry-run: false ######################## # Fixing and committing: @@ -182,16 +179,16 @@ cog.outl("```") #lint: false ## Specify lint commands to run for different languages, eg: "python: flake8 --select=..." (can be used multiple times) -#lint_cmd: +#lint-cmd: ## Enable/disable automatic linting after changes (default: True) -#auto_lint: true +#auto-lint: true ## Specify command to run tests -#test_cmd: +#test-cmd: ## Enable/disable automatic testing after changes (default: False) -#auto_test: false +#auto-test: false ## Run tests and fix problems found #test: false @@ -200,19 +197,19 @@ cog.outl("```") # Other Settings: ## Specify the language for voice using ISO 639-1 code (default: auto) -#voice_language: en +#voice-language: en ## Show the version number and exit -#version: +#version: ## Check for updates and return status in the exit code -#check_update: false +#check-update: false ## Skips checking for the update when the program runs -#skip_check_update: false +#skip-check-update: false ## Apply the changes from the given file instead of running the chat (debug) -#apply: +#apply: ## Always say yes to every confirmation #yes: false @@ -221,22 +218,22 @@ cog.outl("```") #verbose: false ## Print the repo map and exit (debug) -#show_repo_map: false +#show-repo-map: false ## Print the system prompts and exit (debug) -#show_prompts: false +#show-prompts: false ## Specify a single message to send the LLM, process reply then exit (disables chat mode) -#message: +#message: ## Specify a file containing the message to send the LLM, process reply, then exit (disables chat mode) -#message_file: +#message-file: ## Specify the encoding for input and output (default: utf-8) #encoding: utf-8 ## Specify the config file (default: search for .aider.conf.yml in git root, cwd or home directory) -#config: +#config: ## Run aider in your browser #gui: false