mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
allow /commands to provide their own completions
This commit is contained in:
parent
623d36d831
commit
bc43d9ac31
2 changed files with 11 additions and 12 deletions
|
@ -36,12 +36,11 @@ class Commands:
|
|||
self.console.print(f"Error: Command {cmd_name} not found.")
|
||||
|
||||
def get_command_completions(self, cmd_name):
|
||||
cmd_completions_method_name = f"cmd_{cmd_name}_completions"
|
||||
cmd_completions_method_name = f"completions_{cmd_name}"
|
||||
cmd_completions_method = getattr(self, cmd_completions_method_name, None)
|
||||
if cmd_completions_method:
|
||||
return cmd_completions_method()
|
||||
else:
|
||||
return None
|
||||
return set(cmd_completions_method())
|
||||
|
||||
def run(self, inp):
|
||||
words = inp.strip().split()
|
||||
if not words:
|
||||
|
@ -144,7 +143,7 @@ class Commands:
|
|||
else:
|
||||
self.console.print(f"[red]{matched_file} is already in the chat")
|
||||
|
||||
def cmd_add_completions(self):
|
||||
def completions_add(self):
|
||||
return self.coder.get_active_files()
|
||||
|
||||
def cmd_drop(self, args):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue