executor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Registry      = []*RegInfo{}
	GlobalButtons = []string{"/history"}
)

Functions

func Register

func Register(regInfo *RegInfo)

Types

type Executor

type Executor interface {
	// Available after New(). If return nil channel, should use seperated command output channel. Always return same.
	// Will automatically close when executor is closed
	Chan() <-chan string
	Open() error // if return non-nil error, the executor will have been closed. May take some time to return
	Name() string
	History() []string // return cmdline history, last is the latest cmdline
	Buttons() []string // executor level buttons
	Exec(ctx context.Context, cmdline string, isRaw bool) (output chan string)
	Cancel() // cancel currently running commands
	Clear()
	Close() // Chan() may close async after Close() return.
}

Flow: New() -> Open() -> | Exec() / Cancel() / Clear() (support parallel) | -> Close().

func Create

func Create(executorConfig *config.ConfigExecutorStruct, extraOption string) (Executor, error)

The created Executor should hold the executorConfig pointer and ALWAYS use the latest data in it, if possible.

type RegInfo

type RegInfo struct {
	Name    string
	Usage   string
	Creator func(executorConfig *config.ConfigExecutorStruct, extraOption string) (Executor, error)
}

func GetRegInfo

func GetRegInfo(executorType string) *RegInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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