Class JebPythonInterpreter
java.lang.Object
com.pnfsoftware.jeb.client.script.JebPythonInterpreter
- All Implemented Interfaces:
ICommandInterpreter
Python interpreter using Jython.
-
Constructor Summary
ConstructorsConstructorDescriptionJebPythonInterpreter(File scriptsDir, IClientContext ctx) Create a Python command interpreter able to interact with JEB objects. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddToSystemPath(File dir) autoComplete(String command) Provide a best-effort completion suggestion for the provided partial command.executeCommand(String command) Execute a command.executeInternal(String command, boolean allowAutoImport) Retrieve the interpreter's banner/logo string.Get the long name or description.getName()Get the (short) name of this interpreter.voidinjectObject(String name, Object value) booleanvoidprepare()Interpreters may place resource intensive preparation operations here.voidsetAllowAutoImport(boolean allowAutoImport) voidsetTypeInfoProvider(TypeInfoProvider typeinfoprv) booleanDetermine whether this interpreter prefers that the results ofexecuted commandsbe printed as-is.
-
Constructor Details
-
JebPythonInterpreter
Create a Python command interpreter able to interact with JEB objects.- Parameters:
scriptsDir- optional scripts directory, will be added to the interpreter'ssys.pathfor easy importctx- optional JEB context - if provided, the context object will be made available as a global variable `jeb`- Throws:
ExceptionJebException
-
-
Method Details
-
setAllowAutoImport
public void setAllowAutoImport(boolean allowAutoImport) -
isAllowAutoImport
public boolean isAllowAutoImport() -
setTypeInfoProvider
-
getTypeInfoProvider
-
addToSystemPath
-
prepare
public void prepare()Description copied from interface:ICommandInterpreterInterpreters may place resource intensive preparation operations here. Clients may optionally call this method before invoking either:ICommandInterpreter.executeCommand(String)orICommandInterpreter.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.- Specified by:
preparein interfaceICommandInterpreter
-
injectObject
- Throws:
ScriptExecutionException
-
executeCommand
Description copied from interface:ICommandInterpreterExecute a command.- Specified by:
executeCommandin interfaceICommandInterpreter- Returns:
-
executeInternal
-
getAutoImportedTypes
-
getName
Description copied from interface:ICommandInterpreterGet the (short) name of this interpreter.- Specified by:
getNamein interfaceICommandInterpreter- Returns:
- non-null string
-
getDescription
Description copied from interface:ICommandInterpreterGet the long name or description.- Specified by:
getDescriptionin interfaceICommandInterpreter- Returns:
- optional string
-
getBanner
Description copied from interface:ICommandInterpreterRetrieve the interpreter's banner/logo string.- Specified by:
getBannerin interfaceICommandInterpreter- Returns:
- optional string that client code (shells) may display when the interpreter was just instantiated
-
shouldDisplayRawResults
public boolean shouldDisplayRawResults()Description copied from interface:ICommandInterpreterDetermine whether this interpreter prefers that the results ofexecuted commandsbe printed as-is. Clients decide whether or not they want to follow this guideline.- Specified by:
shouldDisplayRawResultsin interfaceICommandInterpreter- Returns:
-
autoComplete
Description copied from interface:ICommandInterpreterProvide a best-effort completion suggestion for the provided partial command.- Specified by:
autoCompletein interfaceICommandInterpreter- Returns:
- optional auto-completion result object
-