Link Search Menu Expand Document

arena-py API v1.0.1

arena.utils.cmd_interpreter

The ArenaCmdInterpreter is a simple line-oriented command interpreter that allows to inspect library/program state. It looks at :envvar:ENABLE_INTERPRETER to enable the interpreter.

The .ArenaCmdInterpreter receives a .Scene instance and provides commands to inspect attributes and execute functions (callables) given to the constructor.

The commands available are: show: displays attributes info: excutes scene functions that output information help: displays the commands available exit: terminates the program

class ArenaCmdInterpreter(cmd.Cmd):

A simple framework for writing line-oriented command interpreters.

These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface.

A Cmd instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate Cmd itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit Cmd's methods and encapsulate action methods.

ArenaCmdInterpreter( scene, show_attrs=('config_data', 'scene', 'users', 'all_objects', 'msg_io'), get_callables=('persisted_objs', 'persisted_scene_option', 'writable_scenes', 'user_list'), start_cmd_event=None)

Instantiate a line-oriented interpreter framework.

The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.

intro = 'Welcome to the arena-py console. Type help or ? to list available commands.\n'
prompt = '# '
file = None
enable_interp
def do_show(self, arg):
def help_show(self):
def do_get(self, arg):
def help_get(self):
def do_exit(self, arg):
def help_exit(self):
Inherited Members
cmd.Cmd
identchars
ruler
lastcmd
doc_leader
doc_header
misc_header
undoc_header
nohelp
use_rawinput
cmdqueue
completekey
cmdloop
precmd
postcmd
preloop
postloop
parseline
onecmd
emptyline
default
completedefault
completenames
complete
get_names
complete_help
do_help
print_topics
columnize