From: Jeremy Stanley Date: Thu, 9 May 2019 20:19:50 +0000 (+0000) Subject: Don't allow abbreviating administrative commands X-Git-Tag: 0.0.1~18 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=5576b96f9280d8b9598d4b4806a016854b6a1c65 Don't allow abbreviating administrative commands If a command is flagged as administrative, don't match substring abbreviations for it. For example, an admin entering "h" should get the help summary, not halt the engine. --- diff --git a/mudpy/misc.py b/mudpy/misc.py index 501d5b4..62501d4 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -1486,8 +1486,10 @@ def find_command(command_name): command = universe.groups["command"][command_name] else: for candidate in sorted(universe.groups["command"]): - if candidate.startswith(command_name): - # the command matches the start of a command word + if candidate.startswith(command_name) and not universe.groups[ + "command"][candidate].get("administrative"): + # the command matches the start of a command word and is not + # restricted to administrators command = universe.groups["command"][candidate] break return command