Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interpreter ¶
type Interpreter struct {
// the cosh shell
Shell *shell.Shell
// the yaegi interpreter
Interp *interp.Interpreter
}
Interpreter represents one running shell context
func NewInterpreter ¶
func NewInterpreter(options interp.Options) *Interpreter
NewInterpreter returns a new Interpreter initialized with the given options. It automatically imports the standard library and configures necessary shell functions. It also calls Interpreter.RunConfig.
func (*Interpreter) Eval ¶
func (in *Interpreter) Eval(code string) error
Eval evaluates (interprets) the given code.
func (*Interpreter) MonitorSignals ¶ added in v0.1.4
func (in *Interpreter) MonitorSignals()
MonitorSignals monitors the operating system signals to appropriately stop the interpreter and prevent the shell from closing on Control+C. It is called automatically in another goroutine in NewInterpreter.
func (*Interpreter) Prompt ¶
func (in *Interpreter) Prompt() string
Prompt returns the appropriate REPL prompt to show the user.
func (*Interpreter) RunCode ¶
func (in *Interpreter) RunCode() (reflect.Value, error)
RunCode runs the accumulated set of code lines and clears the stack.
func (*Interpreter) RunConfig ¶ added in v0.1.4
func (in *Interpreter) RunConfig() error
RunConfig runs the .cosh startup config file in the user's home directory if it exists.