java.lang.Object | |
↳ | com.pnfsoftware.jeb.client.script.PythonInterpreter |
Python interpreter using Jython.
TODO: context reset TODO: history saved across JEB sessions (client side)
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PythonInterpreter(File jythonJar, File scriptsDir, IClientContext ctx)
Create a Python command interpreter that may interact with JEB objects.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | addToSystemPath(File dir) | ||||||||||
AutocompletionResult |
autoComplete(String command)
Provide a best-effort completion suggestion for the provided partial command.
| ||||||||||
ExecutionResult |
executeCommand(String command)
Execute a command.
| ||||||||||
ExecutionResult | executeInternal(String command, boolean allowAutoImport) | ||||||||||
String |
getBanner()
Retrieve the interpreter's banner/logo string.
| ||||||||||
String |
getDescription()
Get the long name or description.
| ||||||||||
String |
getName()
Get the (short) name of this interpreter.
| ||||||||||
TypeInfoProvider | getTypeInfoProvider() | ||||||||||
void | injectObject(String name, Object value) | ||||||||||
boolean | isAllowAutoImport() | ||||||||||
void |
prepare()
Interpreters may place resource intensive preparation operations here.
| ||||||||||
void | setAllowAutoImport(boolean allowAutoImport) | ||||||||||
void | setTypeInfoProvider(TypeInfoProvider typeinfoprv) | ||||||||||
boolean |
shouldDisplayRawResults()
Determine whether this interpreter prefers that the results of
executed commands be printed as-is. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.util.interpreter.ICommandInterpreter
|
Create a Python command interpreter that may interact with JEB objects.
jythonJar | jython.jar to be used - may not be specified if a scripts directory is provided, in which case, the most appropriate jython.jar file will be searched for |
---|---|
scriptsDir | standard scripts directory, will be added to the interpreter's
sys.path for easy import - may not be specified if a jython.jar was
provided, in which case, the containing folder will be used |
ctx | optional JEB context - if provided, the context object will be made available as a global variable `jeb` |
Exception | |
---|---|
JebException |
Provide a best-effort completion suggestion for the provided partial command.
Retrieve the interpreter's banner/logo string.
Get the long name or description.
Get the (short) name of this interpreter.
Interpreters may place resource intensive preparation operations here. Clients may optionally
call this method before invoking either: executeCommand(String)
or
autoComplete(String)
. Clients may decide to not call thsi method. An interpreter
implementation must handle cases where prepare() is never called, sometimes called, called
multiple times, etc.
Determine whether this interpreter prefers that the results of executed commands
be printed as-is. Clients decide whether or not they want to follow this
guideline.