mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 18:26:32 +01:00
help.py display tweak + help aliased to ?
Display tweak resolves difference in display between Telnet and Webclient where coloration of command in format_help_list was not persisting across new lines. Also updates depreciated markup
This commit is contained in:
parent
27f57f7a1b
commit
5e93d41664
1 changed files with 12 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
|||
# limit symbol import for API
|
||||
__all__ = ("CmdHelp", "CmdSetHelp")
|
||||
_DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||
_SEP = "{C" + "-" * _DEFAULT_WIDTH + "{n"
|
||||
_SEP = "|C" + "-" * _DEFAULT_WIDTH + "|n"
|
||||
|
||||
|
||||
class CmdHelp(Command):
|
||||
|
|
@ -36,6 +36,7 @@ class CmdHelp(Command):
|
|||
topics related to the game.
|
||||
"""
|
||||
key = "help"
|
||||
aliases = ['?']
|
||||
locks = "cmd:all()"
|
||||
arg_regex = r"\s|$"
|
||||
|
||||
|
|
@ -89,14 +90,14 @@ class CmdHelp(Command):
|
|||
"""
|
||||
string = _SEP + "\n"
|
||||
if title:
|
||||
string += "{CHelp for {w%s{n" % title
|
||||
string += "|CHelp for |w%s|n" % title
|
||||
if aliases:
|
||||
string += " {C(aliases: %s{C){n" % ("{C,{n ".join("{w%s{n" % ali for ali in aliases))
|
||||
string += " |C(aliases: %s|C)|n" % ("|C,|n ".join("|w%s|n" % ali for ali in aliases))
|
||||
if help_text:
|
||||
string += "\n%s" % dedent(help_text.rstrip())
|
||||
if suggested:
|
||||
string += "\n\n{CSuggested:{n "
|
||||
string += "%s" % fill("{C,{n ".join("{w%s{n" % sug for sug in suggested))
|
||||
string += "\n\n|CSuggested:|n "
|
||||
string += "%s" % fill("|C,|n ".join("|w%s|n" % sug for sug in suggested))
|
||||
string.strip()
|
||||
string += "\n" + _SEP
|
||||
return string
|
||||
|
|
@ -111,15 +112,15 @@ class CmdHelp(Command):
|
|||
"""
|
||||
string = ""
|
||||
if hdict_cmds and any(hdict_cmds.values()):
|
||||
string += "\n" + _SEP + "\n {CCommand help entries{n\n" + _SEP
|
||||
string += "\n" + _SEP + "\n |CCommand help entries|n\n" + _SEP
|
||||
for category in sorted(hdict_cmds.keys()):
|
||||
string += "\n {w%s{n:\n" % (str(category).title())
|
||||
string += "{G" + fill(", ".join(sorted(hdict_cmds[category]))) + "{n"
|
||||
string += "\n |w%s|n:\n" % (str(category).title())
|
||||
string += "|G" + fill("|C, |G".join(sorted(hdict_cmds[category]))) + "|n"
|
||||
if hdict_db and any(hdict_db.values()):
|
||||
string += "\n\n" + _SEP + "\n\r {COther help entries{n\n" + _SEP
|
||||
string += "\n\n" + _SEP + "\n\r |COther help entries|n\n" + _SEP
|
||||
for category in sorted(hdict_db.keys()):
|
||||
string += "\n\r {w%s{n:\n" % (str(category).title())
|
||||
string += "{G" + fill(", ".join(sorted([str(topic) for topic in hdict_db[category]]))) + "{n"
|
||||
string += "\n\r |w%s|n:\n" % (str(category).title())
|
||||
string += "|G" + fill(", ".join(sorted([str(topic) for topic in hdict_db[category]]))) + "|n"
|
||||
return string
|
||||
|
||||
def check_show_help(self, cmd, caller):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue