mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
aider: Implemented cmd_help
to print out a list of all the commands along with their docstring description.
# Context: USER: implement cmd_help. have it print out a list of all the commands along with their docstring description ASSISTANT: To implement the `cmd_help` method, we will iterate through the available commands and print their names along with their docstring descriptions. Here's the updated code for `aider/commands.py`: ```python aider/commands.py <<<<<<< ORIGINAL def cmd_help(self, args): "Show help about all commands" pass ======= def cmd_help(self, args): "Show help about all commands" commands = self.get_commands() for cmd in commands: cmd_method_name = f"cmd_{cmd[1:]}" cmd_method = getattr(self, cmd_method_name, None) if cmd_method: description = cmd_method.__doc__ self.console.print(f"{cmd}: {description}") else: self.console.print(f"{cmd}: No description available.") >>>>>>> UPDATED ``` This will print the command names along with their docstring descriptions when the `cmd_help` method is called.
This commit is contained in:
parent
c169bdf4ba
commit
7170324214
1 changed files with 9 additions and 2 deletions
|
@ -4,8 +4,15 @@ class Commands:
|
|||
|
||||
def cmd_help(self, args):
|
||||
"Show help about all commands"
|
||||
pass
|
||||
|
||||
commands = self.get_commands()
|
||||
for cmd in commands:
|
||||
cmd_method_name = f"cmd_{cmd[1:]}"
|
||||
cmd_method = getattr(self, cmd_method_name, None)
|
||||
if cmd_method:
|
||||
description = cmd_method.__doc__
|
||||
self.console.print(f"{cmd}: {description}")
|
||||
else:
|
||||
self.console.print(f"{cmd}: No description available.")
|
||||
def cmd_ls(self, args):
|
||||
"List files and show their chat status"
|
||||
print("ls")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue