plug

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plug added in v0.0.3

type Plug struct {
	Handlers map[string]func([]byte) (result *messages.Result, exitReason codes.PluginExitReason, e error)
	// contains filtered or unexported fields
}

Plug is a most standard type of plug. It supports one-off comand.

func New

func New() *Plug

New creates basic plug that supports basic options

func (*Plug) Finish added in v0.0.3

func (h *Plug) Finish(message string, code codes.PluginExitReason)

Finish sends confirmation message and exits the plugin

func (*Plug) HandleMessageType added in v0.0.3

func (h *Plug) HandleMessageType(name string, handler func([]byte) (*messages.Result, codes.PluginExitReason, error))

HandleMessageType registers a function that decodes a message of particular type to process it

func (*Plug) Main added in v0.0.3

func (h *Plug) Main() error

Main runs the main loop for a plugin

func (*Plug) Respond added in v0.0.3

func (h *Plug) Respond(t string, v any)

Respond sends raw response to the plugin host. It encapsulates the information in an envelope

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL