command

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PluginID = "command"
)

Variables

View Source
var (
	// ErrHandlerNotFound is returned when a handler is not found.
	ErrHandlerNotFound = errors.New("handler not found")
	// ErrHandlerTimeout is returned when a handler times out.
	ErrHandlerTimeout = errors.New("handler timeout")
)

Functions

func RegisterPlugin

func RegisterPlugin(
	p *sdk.Plugin,
	opts PluginOpts,
) error

Types

type Handler

type Handler func(ctx *types.PluginContext, body []byte) ([]byte, error)

Handler is a function that processes a command called from the frontend. It is expected to return the response body as a byte slice.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages the lifecycle of the terminal sessions.

func NewManager

func NewManager(
	log logging.Logger,
	sp settings.Provider,
	handlers map[string]Handler,
) *Manager

NewManager initializes a new Manager instance.

func (*Manager) Call

func (m *Manager) Call(
	ctx *types.PluginContext,
	target string,
	payload []byte,
) ([]byte, error)

type Plugin

type Plugin struct {
	plugin.Plugin
	Impl Provider
}

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(
	_ context.Context,
	_ *plugin.GRPCBroker,
	c *grpc.ClientConn,
) (interface{}, error)

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type PluginClient

type PluginClient struct {
	// contains filtered or unexported fields
}

func (*PluginClient) Call

func (p *PluginClient) Call(
	ctx *types.PluginContext,
	path string,
	body []byte,
) ([]byte, error)

type PluginOpts

type PluginOpts struct {
	Handlers map[string]Handler `json:"handlers"`
}

PluginOpts contains the options for the command plugin.

type PluginServer

type PluginServer struct {
	Impl Provider
}

func (*PluginServer) Call

type Provider

type Provider interface {
	ProviderImpl
}

Provider is the interface satisfied by the plugin server and client to provide the general functionality.

type ProviderImpl

type ProviderImpl interface {
	Call(ctx *types.PluginContext, target string, payload []byte) ([]byte, error)
}

Jump to

Keyboard shortcuts

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