From 762da2d1bcf0507425858d17e3bac5400e7d4cb6 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 15 Nov 2020 11:30:09 +0100 Subject: [PATCH] Some minor refactorings --- evennia/commands/default/help.py | 35 ++++++++++++-------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/evennia/commands/default/help.py b/evennia/commands/default/help.py index bedf3fcbf6..44c4ae727f 100644 --- a/evennia/commands/default/help.py +++ b/evennia/commands/default/help.py @@ -168,29 +168,20 @@ class CmdHelp(Command): Returns the formatted string, ready to be sent. """ - start_chunk = f"{_SEP}\n" - title_chunk = f"|CHelp for |w{title}|n" if title else "" - aliases_chunk = " |C(aliases: {}|C)|n" \ - .format("|C,|n ".join(f"|w{ali}|n" for ali in aliases)) \ - if aliases else "" - help_text_chunk = f"\n{dedent(help_text.rstrip())}" \ - if help_text else "" - suggested_chunk = \ - "\n\n|CSuggested:|n {}" \ - .format(fill("|C,|n ".join(f"|w{sug}|n" for sug in suggested))) \ - if suggested else "" - end_chunk = f"\n{_SEP}" + start = f"{_SEP}\n" + title = f"|CHelp for |w{title}|n" if title else "" + aliases = ( + " |C(aliases: {}|C)|n".format("|C,|n ".join(f"|w{ali}|n" for ali in aliases)) + if aliases else "") + help_text = ( + f"\n{dedent(help_text.rstrip())}"if help_text else "") + suggested = ( + "\n\n|CSuggested:|n {}".format( + fill("|C,|n ".join(f"|w{sug}|n" for sug in suggested))) + if suggested else "") + end = 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 "".join((start, title, aliases, help_text, suggested, end)) def format_help_list(self, hdict_cmds, hdict_db): """