mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44: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 configargparse
|
||||||
import shtab
|
import shtab
|
||||||
|
from aider.coders.base_coder import Coder
|
||||||
|
|
||||||
from aider import __version__
|
from aider import __version__
|
||||||
from aider.args_formatter import (
|
from aider.args_formatter import (
|
||||||
|
@ -40,6 +41,10 @@ def get_parser(default_config_files, git_root):
|
||||||
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
||||||
auto_env_var_prefix="AIDER_",
|
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 = parser.add_argument_group("Main model")
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"files", metavar="FILE", nargs="*", help="files to edit with an LLM (optional)"
|
"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",
|
"--edit-format",
|
||||||
"--chat-mode",
|
"--chat-mode",
|
||||||
metavar="EDIT_FORMAT",
|
metavar="EDIT_FORMAT",
|
||||||
|
choices=edit_format_choices,
|
||||||
default=None,
|
default=None,
|
||||||
help="Specify what edit format the LLM should use (default depends on model)",
|
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(
|
group.add_argument(
|
||||||
"--editor-edit-format",
|
"--editor-edit-format",
|
||||||
metavar="EDITOR_EDIT_FORMAT",
|
metavar="EDITOR_EDIT_FORMAT",
|
||||||
|
choices=edit_format_choices,
|
||||||
default=None,
|
default=None,
|
||||||
help="Specify the edit format for the editor model (default: depends on editor model)",
|
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