From 7170324214f0d323ea70274a394214ebfb7e7696 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 10 May 2023 11:22:55 -0700 Subject: [PATCH] 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. --- aider/commands.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 783e6905c..c50e6e23d 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -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")