detect

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CY_HOOK     = "cy"
	TEST_PROMPT = "\033Pcy\033\\$ "
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// The directory in which this command was executed, as provided by
	// OSC-7
	Directory string

	// The human-readable representation of this command as it appeared
	// originally.
	Text string
	// In certain circumstances, input is not contiguous
	Input []search.Selection
	// But output always is
	Output search.Selection
	// Whether this command is still in progress. If true, `Output` will
	// not be valid.
	Pending bool

	// The indices of the event where each of these stages occurred.
	// The event at which the user was prompted
	Prompted int
	// The event at which the command was executed (it was finished being
	// input)
	Executed int
	// The event at which the command finished executing (its output ended)
	Completed int

	// The time at which this command was executed
	ExecutedAt time.Time
	// The time at which this command finished executing
	CompletedAt time.Time
	// contains filtered or unexported fields
}

func (Command) InputStart

func (c Command) InputStart() geom.Vec2

type CommandHandler added in v0.11.0

type CommandHandler func(Command)

type Detector

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

func New

func New(options ...Option) *Detector

func (*Detector) Commands

func (d *Detector) Commands(
	term emu.Terminal,
	events []sessions.Event,
) []Command

func (*Detector) Detect

func (d *Detector) Detect(
	term emu.Terminal,
	events []sessions.Event,
)

type DirectoryProvider added in v0.11.0

type DirectoryProvider func() string

type Option added in v0.11.0

type Option func(*Detector)

func WithDirectoryProvider added in v0.11.0

func WithDirectoryProvider(c DirectoryProvider) Option

WithDirectoryProvider provides a function that will be called to get the current directory of the process attached to the terminal.

func WithHandler added in v0.11.0

func WithHandler(c CommandHandler) Option

WithHandler allows you to provide a callback that will be invoked whenever a command finishes executing.

Jump to

Keyboard shortcuts

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