Add cmdsets to show off cmds in tutorial menu

This commit is contained in:
Griatch 2020-10-01 23:49:04 +02:00
parent 84e26566ae
commit b28aefd36f
4 changed files with 243 additions and 48 deletions

View file

@ -219,10 +219,12 @@ class CmdHelp(Command):
hdict_topic = defaultdict(list)
# create the dictionaries {category:[topic, topic ...]} required by format_help_list
# Filter commands that should be reached by the help
# system, but not be displayed in the table.
# system, but not be displayed in the table, or be displayed differently.
for cmd in all_cmds:
if self.should_list_cmd(cmd, caller):
hdict_cmd[cmd.help_category].append(cmd.key)
key = (cmd.auto_help_display_key
if hasattr(cmd, "auto_help_display_key") else cmd.key)
hdict_cmd[cmd.help_category].append(key)
[hdict_topic[topic.help_category].append(topic.key) for topic in all_topics]
# report back
self.msg_help(self.format_help_list(hdict_cmd, hdict_topic))
@ -266,10 +268,12 @@ class CmdHelp(Command):
]
if len(match) == 1:
cmd = match[0]
key = cmd.auto_help_display_key if hasattr(cmd, "auto_help_display_key") else cmd.key
formatted = self.format_help_entry(
match[0].key,
match[0].get_help(caller, cmdset),
aliases=match[0].aliases,
key,
cmd.get_help(caller, cmdset),
aliases=cmd.aliases,
suggested=suggestions,
)
self.msg_help(formatted)
@ -290,8 +294,10 @@ class CmdHelp(Command):
# try to see if a category name was entered
if query in all_categories:
self.msg_help(
self.format_help_list(
{query: [cmd.key for cmd in all_cmds if cmd.help_category == query]},
self.format_help_list({
query: [
cmd.auto_help_display_key if hasattr(cmd, "auto_help_display_key") else cmd.key
for cmd in all_cmds if cmd.help_category == query]},
{query: [topic.key for topic in all_topics if topic.help_category == query]},
)
)