core.components.cli module

class core.components.cli.CommandLine(app)[source]

Bases: cmd.Cmd

A class to enable an interactive debug command line. Provides a full python shell to review and modify variables while the game is actively running.

Parameters:app (tuxemon.Game) – The tuxemon.Game object of the game itself.

To include the command line in the game, simply add the following line under the initialization of the main game:

>>> def __init__(self):
...     self.cli = core.cli.CommandLine(self) 
do_EOF(line)[source]

If you press CTRL-D on the command line, set the app’s exit variable to True.

Parameters:None
Return type:None
Returns:None

Print the copyright information if “copyright” was entered.

Parameters:None
Return type:None
Returns:None
do_credits(line)[source]

Print the copyright information if “credits” was entered.

Parameters:None
Return type:None
Returns:None
do_exit(line)[source]

If “exit” was typed on the command line, set the app’s exit variable to True.

Parameters:None
Return type:None
Returns:None
do_python(line)[source]

Open a full python shell if “python” was typed in the command line. From here, you can look at and manipulate any variables in the application. This can be used to look at this instance’s “self.app” variable which contains the game object.

Parameters:None
Return type:None
Returns:None
do_quit(line)[source]

If “quit” was typed on the command line, set the app’s exit variable to True.

Parameters:None
Return type:None
Returns:None
emptyline()[source]

If an empty line was entered at the command line, do nothing.

Parameters:None
Return type:None
Returns:None
postcmd(stop, line)[source]

If the application has exited, exit here as well.

Parameters:None
Return type:None
Returns:None