From 866e5dce4188da667a7d252d444050b6e0ed2894 Mon Sep 17 00:00:00 2001 From: Ryan Stein Date: Thu, 5 Oct 2017 12:01:53 -0400 Subject: [PATCH] make help command's matching respect CMD_IGNORE_PREFIXES --- evennia/commands/default/help.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/evennia/commands/default/help.py b/evennia/commands/default/help.py index 715f0ad17..6f09f9806 100644 --- a/evennia/commands/default/help.py +++ b/evennia/commands/default/help.py @@ -17,6 +17,7 @@ from evennia.utils.utils import string_suggestions, class_from_module COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS) HELP_MORE = settings.HELP_MORE +CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES # limit symbol import for API __all__ = ("CmdHelp", "CmdSetHelp") @@ -231,6 +232,15 @@ class CmdHelp(Command): # try an exact command auto-help match match = [cmd for cmd in all_cmds if cmd == query] + + if not match: + # try an inexact match with prefixes stripped from query and cmds + _query = query[1:] if query[0] in CMD_IGNORE_PREFIXES else query + + match = [cmd for cmd in all_cmds + for m in cmd._matchset if m == _query or + m[0] in CMD_IGNORE_PREFIXES and m[1:] == _query] + if len(match) == 1: formatted = self.format_help_entry(match[0].key, match[0].get_help(caller, cmdset),