mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
aider: Implemented get_command_completions
method to call the corresponding cmd_{cmd_name}_completions
method if it exists and return its result, otherwise return None.
# Context: USER: implement get_command_completions. it should look for f"cmd_{cmd_name}_completions" and call that function and return the results. if the functionn isn't found return None. ASSISTANT: To implement the `get_command_completions` method, we will call the corresponding `cmd_{cmd_name}_completions` method if it exists and return its result. If the method is not found, we will return None. Here's the updated code for `aider/commands.py`: ```python aider/commands.py <<<<<<< ORIGINAL def get_command_completions(self, cmd_name): pass ======= def get_command_completions(self, cmd_name): cmd_completions_method_name = f"cmd_{cmd_name}_completions" cmd_completions_method = getattr(self, cmd_completions_method_name, None) if cmd_completions_method: return cmd_completions_method() else: return None >>>>>>> UPDATED ```
This commit is contained in:
parent
b66ac52388
commit
623d36d831
1 changed files with 10 additions and 0 deletions
|
@ -35,6 +35,13 @@ class Commands:
|
|||
else:
|
||||
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 = getattr(self, cmd_completions_method_name, None)
|
||||
if cmd_completions_method:
|
||||
return cmd_completions_method()
|
||||
else:
|
||||
return None
|
||||
def run(self, inp):
|
||||
words = inp.strip().split()
|
||||
if not words:
|
||||
|
@ -137,6 +144,9 @@ class Commands:
|
|||
else:
|
||||
self.console.print(f"[red]{matched_file} is already in the chat")
|
||||
|
||||
def cmd_add_completions(self):
|
||||
return self.coder.get_active_files()
|
||||
|
||||
def cmd_drop(self, args):
|
||||
"Remove matching files from the chat"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue