scriptmanager

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

func (*Command) Invoke

func (c *Command) Invoke(ctx context.Context, args []string, errChan chan error) error

Invoke will schedule the command for invocation. If the script scheduler is free, it will be started immediately. Otherwise an error will be returned.

type Ifaces

type Ifaces struct {
	UI      UIService
	Session SessionService
}

type QueryOptions

type QueryOptions struct {
	TableName         string
	IndexName         string
	NamePlaceholders  map[string]string
	ValuePlaceholders map[string]types.AttributeValue
}

type ScriptPlugin

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

func (*ScriptPlugin) Name

func (sp *ScriptPlugin) Name() string

type Service

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

func New

func New(opts ...ServiceOption) *Service

func (*Service) LoadScript

func (s *Service) LoadScript(ctx context.Context, filename string) (*ScriptPlugin, error)

func (*Service) LookupCommand

func (s *Service) LookupCommand(name string) *Command

LookupCommand looks up a command defined by a script. TODO: Command should probably accept/return a chan error to indicate that this will run in a separate goroutine

func (*Service) LookupKeyBinding

func (s *Service) LookupKeyBinding(key string) (string, *Command)

func (*Service) RebindKeyBinding

func (s *Service) RebindKeyBinding(keyBinding string, newKey string) error

func (*Service) RelatedItemOfItem added in v0.4.0

func (s *Service) RelatedItemOfItem(ctx context.Context, rs *models.ResultSet, index int) ([]relitems.RelatedItem, error)

func (*Service) RunAdHocScript

func (s *Service) RunAdHocScript(ctx context.Context, filename string) chan error

func (*Service) SetIFaces

func (s *Service) SetIFaces(ifaces Ifaces)

func (*Service) SetLookupPaths

func (s *Service) SetLookupPaths(fs []fs.FS)

func (*Service) StartAdHocScript

func (s *Service) StartAdHocScript(ctx context.Context, filename string, errChan chan error) error

func (*Service) UnbindKey

func (s *Service) UnbindKey(key string)

type ServiceOption

type ServiceOption func(srv *Service)

func WithFS

func WithFS(fs ...fs.FS) ServiceOption

type SessionService

type SessionService interface {
	Query(ctx context.Context, expr string, queryOptions QueryOptions) (*models.ResultSet, error)

	ResultSet(ctx context.Context) *models.ResultSet
	SelectedItemIndex(ctx context.Context) int
	SetResultSet(ctx context.Context, newResultSet *models.ResultSet)
}

type UIService

type UIService interface {
	PrintMessage(ctx context.Context, msg string)

	// Prompt should return a channel which will provide the input from the user.  If the user
	// provides no input, prompt should close the channel without providing anything.
	Prompt(ctx context.Context, msg string) chan string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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