chore: Add shtab file completions to args

This commit is contained in:
Paul Gauthier (aider) 2025-05-10 17:56:29 -07:00
parent 2c4a126093
commit b1d47c47d9

View file

@ -43,7 +43,7 @@ def get_parser(default_config_files, git_root):
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)"
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--model", "--model",
metavar="MODEL", metavar="MODEL",
@ -110,13 +110,13 @@ def get_parser(default_config_files, git_root):
metavar="MODEL_SETTINGS_FILE", metavar="MODEL_SETTINGS_FILE",
default=".aider.model.settings.yml", default=".aider.model.settings.yml",
help="Specify a file with aider model settings for unknown models", help="Specify a file with aider model settings for unknown models",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--model-metadata-file", "--model-metadata-file",
metavar="MODEL_METADATA_FILE", metavar="MODEL_METADATA_FILE",
default=".aider.model.metadata.json", default=".aider.model.metadata.json",
help="Specify a file with context window and costs for unknown models", help="Specify a file with context window and costs for unknown models",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--alias", "--alias",
action="append", action="append",
@ -262,13 +262,13 @@ def get_parser(default_config_files, git_root):
metavar="INPUT_HISTORY_FILE", metavar="INPUT_HISTORY_FILE",
default=default_input_history_file, default=default_input_history_file,
help=f"Specify the chat input history file (default: {default_input_history_file})", help=f"Specify the chat input history file (default: {default_input_history_file})",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--chat-history-file", "--chat-history-file",
metavar="CHAT_HISTORY_FILE", metavar="CHAT_HISTORY_FILE",
default=default_chat_history_file, default=default_chat_history_file,
help=f"Specify the chat history file (default: {default_chat_history_file})", help=f"Specify the chat history file (default: {default_chat_history_file})",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--restore-chat-history", "--restore-chat-history",
action=argparse.BooleanOptionalAction, action=argparse.BooleanOptionalAction,
@ -280,7 +280,7 @@ def get_parser(default_config_files, git_root):
metavar="LLM_HISTORY_FILE", metavar="LLM_HISTORY_FILE",
default=None, default=None,
help="Log the conversation with the LLM to this file (for example, .aider.llm.history)", help="Log the conversation with the LLM to this file (for example, .aider.llm.history)",
) ).complete = shtab.FILE
########## ##########
group = parser.add_argument_group("Output settings") group = parser.add_argument_group("Output settings")
@ -406,7 +406,7 @@ def get_parser(default_config_files, git_root):
type=lambda path_str: resolve_aiderignore_path(path_str, git_root), type=lambda path_str: resolve_aiderignore_path(path_str, git_root),
default=default_aiderignore_file, default=default_aiderignore_file,
help="Specify the aider ignore file (default: .aiderignore in git root)", help="Specify the aider ignore file (default: .aiderignore in git root)",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--subtree-only", "--subtree-only",
action="store_true", action="store_true",
@ -619,7 +619,7 @@ def get_parser(default_config_files, git_root):
"Specify a file containing the message to send the LLM, process reply, then exit" "Specify a file containing the message to send the LLM, process reply, then exit"
" (disables chat mode)" " (disables chat mode)"
), ),
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--gui", "--gui",
"--browser", "--browser",
@ -637,7 +637,7 @@ def get_parser(default_config_files, git_root):
"--apply", "--apply",
metavar="FILE", metavar="FILE",
help="Apply the changes from the given file instead of running the chat (debug)", help="Apply the changes from the given file instead of running the chat (debug)",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--apply-clipboard-edits", "--apply-clipboard-edits",
action="store_true", action="store_true",
@ -698,13 +698,13 @@ def get_parser(default_config_files, git_root):
action="append", action="append",
metavar="FILE", metavar="FILE",
help="specify a file to edit (can be used multiple times)", help="specify a file to edit (can be used multiple times)",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--read", "--read",
action="append", action="append",
metavar="FILE", metavar="FILE",
help="specify a read-only file (can be used multiple times)", help="specify a read-only file (can be used multiple times)",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--vim", "--vim",
action="store_true", action="store_true",
@ -734,7 +734,7 @@ def get_parser(default_config_files, git_root):
"--load", "--load",
metavar="LOAD_FILE", metavar="LOAD_FILE",
help="Load and execute /commands from a file on launch", help="Load and execute /commands from a file on launch",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--encoding", "--encoding",
default="utf-8", default="utf-8",
@ -763,7 +763,7 @@ def get_parser(default_config_files, git_root):
metavar="ENV_FILE", metavar="ENV_FILE",
default=default_env_file(git_root), default=default_env_file(git_root),
help="Specify the .env file to load (default: .env in git root)", help="Specify the .env file to load (default: .env in git root)",
) ).complete = shtab.FILE
group.add_argument( group.add_argument(
"--suggest-shell-commands", "--suggest-shell-commands",
action=argparse.BooleanOptionalAction, action=argparse.BooleanOptionalAction,