public class

JebPythonInterpreter

extends Object
implements ICommandInterpreter
java.lang.Object
   ↳ com.pnfsoftware.jeb.client.script.JebPythonInterpreter

Class Overview

Python interpreter using Jython.

Summary

Public Constructors
JebPythonInterpreter(File scriptsDir, IClientContext ctx)
Create a Python command interpreter able to 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)
Collection<String> getAutoImportedTypes()
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

Public Constructors

public JebPythonInterpreter (File scriptsDir, IClientContext ctx)

Create a Python command interpreter able to interact with JEB objects.

Parameters
scriptsDir optional scripts directory, will be added to the interpreter's sys.path for easy import
ctx optional JEB context - if provided, the context object will be made available as a global variable `jeb`
Throws
Exception
JebException

Public Methods

public boolean addToSystemPath (File dir)

public AutocompletionResult autoComplete (String command)

Provide a best-effort completion suggestion for the provided partial command.

Returns
  • optional auto-completion result object

public ExecutionResult executeCommand (String command)

Execute a command.

public ExecutionResult executeInternal (String command, boolean allowAutoImport)

public Collection<String> getAutoImportedTypes ()

public String getBanner ()

Retrieve the interpreter's banner/logo string.

Returns
  • optional string that client code (shells) may display when the interpreter was just instantiated

public String getDescription ()

Get the long name or description.

Returns
  • optional string

public String getName ()

Get the (short) name of this interpreter.

Returns
  • non-null string

public TypeInfoProvider getTypeInfoProvider ()

public void injectObject (String name, Object value)

public boolean isAllowAutoImport ()

public void prepare ()

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.

public void setAllowAutoImport (boolean allowAutoImport)

public void setTypeInfoProvider (TypeInfoProvider typeinfoprv)

public boolean shouldDisplayRawResults ()

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.