Merge branch 'command_info' of https://github.com/volundmush/evennia into volundmush-command_info
This commit is contained in:
commit
bec5c16bf7
3 changed files with 42 additions and 9 deletions
|
|
@ -7,6 +7,9 @@
|
||||||
|
|
||||||
### Already in master
|
### Already in master
|
||||||
|
|
||||||
|
- Moved behavior of default `Command` and `MuxCommand` `.func()` to new `.get_command_info()`
|
||||||
|
method so the debug info can be called even if `.func()` is overloaded. `.func()` now calls
|
||||||
|
this new method by default. (Volund)
|
||||||
- `py` command now reroutes stdout to output results in-game client. `py`
|
- `py` command now reroutes stdout to output results in-game client. `py`
|
||||||
without arguments starts a full interactive Python console.
|
without arguments starts a full interactive Python console.
|
||||||
- Webclient default to a single input pane instead of two. Now defaults to no help-popup.
|
- Webclient default to a single input pane instead of two. Now defaults to no help-popup.
|
||||||
|
|
|
||||||
|
|
@ -401,12 +401,20 @@ class Command(object, metaclass=CommandMeta):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def func(self):
|
def get_command_info(self):
|
||||||
"""
|
"""
|
||||||
This is the actual executing part of the command. It is
|
This is the default output of func() if no func() overload is done.
|
||||||
called directly after self.parse(). See the docstring of this
|
Provided here as a separate method so that it can be called for debugging
|
||||||
module for which object properties are available (beyond those
|
purposes when making commands.
|
||||||
set in self.parse())
|
|
||||||
|
"""
|
||||||
|
self.get_command_info()
|
||||||
|
|
||||||
|
def get_command_info(self):
|
||||||
|
"""
|
||||||
|
This is the default output of func() if no func() overload is done.
|
||||||
|
Provided here as a separate method so that it can be called for debugging
|
||||||
|
purposes when making commands.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
variables = "\n".join(
|
variables = "\n".join(
|
||||||
|
|
@ -438,6 +446,16 @@ Command {self} has no defined `func()` - showing on-command variables:
|
||||||
|
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
|
|
||||||
|
def func(self):
|
||||||
|
"""
|
||||||
|
This is the actual executing part of the command. It is
|
||||||
|
called directly after self.parse(). See the docstring of this
|
||||||
|
module for which object properties are available (beyond those
|
||||||
|
set in self.parse())
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.get_command_info()
|
||||||
|
|
||||||
def get_extra_info(self, caller, **kwargs):
|
def get_extra_info(self, caller, **kwargs):
|
||||||
"""
|
"""
|
||||||
Display some extra information that may help distinguish this
|
Display some extra information that may help distinguish this
|
||||||
|
|
|
||||||
|
|
@ -202,11 +202,15 @@ class MuxCommand(Command):
|
||||||
else:
|
else:
|
||||||
self.character = None
|
self.character = None
|
||||||
|
|
||||||
def func(self):
|
def get_command_info(self):
|
||||||
"""
|
"""
|
||||||
This is the hook function that actually does all the work. It is called
|
Update of parent class's get_command_info() for MuxCommand.
|
||||||
by the cmdhandler right after self.parser() finishes, and so has access
|
"""
|
||||||
to all the variables defined therein.
|
self.get_command_info()
|
||||||
|
|
||||||
|
def get_command_info(self):
|
||||||
|
"""
|
||||||
|
Update of parent class's get_command_info() for MuxCommand.
|
||||||
"""
|
"""
|
||||||
variables = "\n".join(
|
variables = "\n".join(
|
||||||
" |w{}|n ({}): {}".format(key, type(val), val) for key, val in self.__dict__.items()
|
" |w{}|n ({}): {}".format(key, type(val), val) for key, val in self.__dict__.items()
|
||||||
|
|
@ -245,6 +249,14 @@ Command {self} has no defined `func()` - showing on-command variables: No child
|
||||||
string += "-" * 50
|
string += "-" * 50
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
|
|
||||||
|
def func(self):
|
||||||
|
"""
|
||||||
|
This is the hook function that actually does all the work. It is called
|
||||||
|
by the cmdhandler right after self.parser() finishes, and so has access
|
||||||
|
to all the variables defined therein.
|
||||||
|
"""
|
||||||
|
self.get_command_info()
|
||||||
|
|
||||||
|
|
||||||
class MuxAccountCommand(MuxCommand):
|
class MuxAccountCommand(MuxCommand):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue