From: Jeremy Stanley Date: Sun, 5 May 2019 16:20:48 +0000 (+0000) Subject: Add a prompt generator method X-Git-Tag: 0.0.1~25 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=f0c07e0cbc98ffc01b59d15a0e9854b04ebc8a78;p=mudpy.git Add a prompt generator method Move the retrieval and assembly of the prompt string fragment for active state users into its own method, paving the way for more dynamic and extensible prompts. --- diff --git a/mudpy/misc.py b/mudpy/misc.py index 0e7e561..b4009c9 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -661,6 +661,10 @@ class User: self.error = False self.adjust_echoing() + def prompt(self): + """"Generate and return an input prompt.""" + return self.account.get("prompt", ">") + " " + def adjust_echoing(self): """Adjust echoing to match state menu requirements.""" if mudpy.telnet.is_enabled(self, mudpy.telnet.TELOPT_ECHO, @@ -723,7 +727,7 @@ class User: if not just_prompt: output += "$(eol)" if add_prompt: - output += self.account.get("prompt", ">") + " " + output += self.prompt() mode = self.avatar.get("mode") if mode: output += "(" + mode + ") "