Merge branch 'refactor' of https://github.com/Vikka/evennia into Vikka-refactor
This commit is contained in:
commit
77c2f556e3
1 changed files with 22 additions and 12 deletions
|
|
@ -168,18 +168,28 @@ class CmdHelp(Command):
|
||||||
Returns the formatted string, ready to be sent.
|
Returns the formatted string, ready to be sent.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
string = _SEP + "\n"
|
start_chunk = f"{_SEP}\n"
|
||||||
if title:
|
title_chunk = f"|CHelp for |w{title}|n" if title else ""
|
||||||
string += "|CHelp for |w%s|n" % title
|
aliases_chunk = " |C(aliases: {}|C)|n" \
|
||||||
if aliases:
|
.format("|C,|n ".join(f"|w{ali}|n" for ali in aliases)) \
|
||||||
string += " |C(aliases: %s|C)|n" % ("|C,|n ".join("|w%s|n" % ali for ali in aliases))
|
if aliases else ""
|
||||||
if help_text:
|
help_text_chunk = f"\n{dedent(help_text.rstrip())}" \
|
||||||
string += "\n%s" % dedent(help_text.rstrip())
|
if help_text else ""
|
||||||
if suggested:
|
suggested_chunk = \
|
||||||
string += "\n\n|CSuggested:|n "
|
"\n\n|CSuggested:|n {}" \
|
||||||
string += "%s" % fill("|C,|n ".join("|w%s|n" % sug for sug in suggested))
|
.format(fill("|C,|n ".join(f"|w{sug}|n" for sug in suggested))) \
|
||||||
string.strip()
|
if suggested else ""
|
||||||
string += "\n" + _SEP
|
end_chunk = f"\n{_SEP}"
|
||||||
|
|
||||||
|
help_entry_chunks = [
|
||||||
|
start_chunk,
|
||||||
|
title_chunk,
|
||||||
|
aliases_chunk,
|
||||||
|
help_text_chunk,
|
||||||
|
suggested_chunk,
|
||||||
|
end_chunk,
|
||||||
|
]
|
||||||
|
string = "".join(help_entry_chunks)
|
||||||
return string
|
return string
|
||||||
|
|
||||||
def format_help_list(self, hdict_cmds, hdict_db):
|
def format_help_list(self, hdict_cmds, hdict_db):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue