mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
feat: Add shell completion for edit format options
This commit is contained in:
parent
b1d47c47d9
commit
f8653613bc
1 changed files with 7 additions and 0 deletions
|
@ -7,6 +7,7 @@ from pathlib import Path
|
|||
|
||||
import configargparse
|
||||
import shtab
|
||||
from aider.coders.base_coder import Coder
|
||||
|
||||
from aider import __version__
|
||||
from aider.args_formatter import (
|
||||
|
@ -40,6 +41,10 @@ def get_parser(default_config_files, git_root):
|
|||
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
||||
auto_env_var_prefix="AIDER_",
|
||||
)
|
||||
# List of valid edit formats for argparse validation & shtab completion
|
||||
edit_format_choices = sorted(
|
||||
getattr(Coder, "EDIT_FORMATS", ["architect", "diff", "patch", "unified_diff"])
|
||||
)
|
||||
group = parser.add_argument_group("Main model")
|
||||
group.add_argument(
|
||||
"files", metavar="FILE", nargs="*", help="files to edit with an LLM (optional)"
|
||||
|
@ -149,6 +154,7 @@ def get_parser(default_config_files, git_root):
|
|||
"--edit-format",
|
||||
"--chat-mode",
|
||||
metavar="EDIT_FORMAT",
|
||||
choices=edit_format_choices,
|
||||
default=None,
|
||||
help="Specify what edit format the LLM should use (default depends on model)",
|
||||
)
|
||||
|
@ -183,6 +189,7 @@ def get_parser(default_config_files, git_root):
|
|||
group.add_argument(
|
||||
"--editor-edit-format",
|
||||
metavar="EDITOR_EDIT_FORMAT",
|
||||
choices=edit_format_choices,
|
||||
default=None,
|
||||
help="Specify the edit format for the editor model (default: depends on editor model)",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue