coq for in-chat commands

This commit is contained in:
Paul Gauthier 2024-06-05 20:10:48 -07:00
parent 47346af823
commit e3cc69d0c8
3 changed files with 63 additions and 27 deletions

View file

@ -639,6 +639,22 @@ class Commands:
else:
self.io.tool_output(f"{cmd} No description available.")
def get_help_md(self):
"Show help about all commands in markdown"
res = ""
commands = sorted(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__
res += f"- **{cmd}** {description}\n"
else:
res += f"- **{cmd}**\n"
return res
def cmd_voice(self, args):
"Record and transcribe voice input"
@ -702,3 +718,22 @@ def parse_quoted_filenames(args):
filenames = re.findall(r"\"(.+?)\"|(\S+)", args)
filenames = [name for sublist in filenames for name in sublist if name]
return filenames
def get_help_md():
from aider.coders import Coder
from aider.models import Model
coder = Coder(Model("gpt-3.5-turbo"), None)
md = coder.commands.get_help_md()
return md
def main():
md = get_help_md()
print(md)
if __name__ == "__main__":
status = main()
sys.exit(status)