context

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCustomCommands added in v0.9.0

func LoadCustomCommands(output string) (map[string]CustomCommand, error)

Types

type CommandRunner added in v0.8.12

type CommandRunner interface {
	RunCommandImmediate(args []string) ([]byte, error)
	RunCommandStreaming(ctx context.Context, args []string) (*StreamingCommand, error)
	RunCommand(args []string, continuations ...tea.Cmd) tea.Cmd
	RunInteractiveCommand(args []string, continuation tea.Cmd) tea.Cmd
}

type CustomCommand added in v0.9.0

type CustomCommand interface {
	Binding() key.Binding
	Sequence() []key.Binding
	Description(ctx *MainContext) string
	Prepare(ctx *MainContext) tea.Cmd
	IsApplicableTo(item SelectedItem) bool
}

type CustomCommandBase added in v0.9.0

type CustomCommandBase struct {
	Name        string
	Desc        string   `toml:"desc"`
	Key         []string `toml:"key"`
	KeySequence []string `toml:"key_sequence"`
}

func (CustomCommandBase) Binding added in v0.9.0

func (c CustomCommandBase) Binding() key.Binding

func (CustomCommandBase) Label added in v0.9.8

func (c CustomCommandBase) Label() string

func (CustomCommandBase) Sequence added in v0.9.8

func (c CustomCommandBase) Sequence() []key.Binding

type CustomLuaCommand added in v0.9.8

type CustomLuaCommand struct {
	CustomCommandBase
	Script string `toml:"lua"`
}

CustomLuaCommand executes a Lua script via the capability bridge.

func (CustomLuaCommand) Description added in v0.9.8

func (c CustomLuaCommand) Description(ctx *MainContext) string

func (CustomLuaCommand) IsApplicableTo added in v0.9.8

func (c CustomLuaCommand) IsApplicableTo(item SelectedItem) bool

func (CustomLuaCommand) Prepare added in v0.9.8

func (c CustomLuaCommand) Prepare(ctx *MainContext) tea.Cmd

type CustomRevsetCommand added in v0.9.0

type CustomRevsetCommand struct {
	CustomCommandBase
	Revset string `toml:"revset"`
}

func (CustomRevsetCommand) Description added in v0.9.0

func (c CustomRevsetCommand) Description(ctx *MainContext) string

func (CustomRevsetCommand) IsApplicableTo added in v0.9.0

func (c CustomRevsetCommand) IsApplicableTo(item SelectedItem) bool

func (CustomRevsetCommand) Prepare added in v0.9.0

func (c CustomRevsetCommand) Prepare(ctx *MainContext) tea.Cmd

type CustomRunCommand added in v0.9.0

type CustomRunCommand struct {
	CustomCommandBase
	Args []string          `toml:"args"`
	Show config.ShowOption `toml:"show"`
}

func (CustomRunCommand) Description added in v0.9.0

func (c CustomRunCommand) Description(ctx *MainContext) string

func (CustomRunCommand) IsApplicableTo added in v0.9.0

func (c CustomRunCommand) IsApplicableTo(item SelectedItem) bool

func (CustomRunCommand) Prepare added in v0.9.0

func (c CustomRunCommand) Prepare(ctx *MainContext) tea.Cmd

type LabeledCommand added in v0.9.8

type LabeledCommand interface {
	Label() string
}

type Leader added in v0.9.0

type Leader struct {
	Bind    *key.Binding
	Send    []string
	Context []string
	Nest    LeaderMap
}

type LeaderMap added in v0.9.0

type LeaderMap = map[string]*Leader

func LoadLeader added in v0.9.0

func LoadLeader(content string) (LeaderMap, error)

type MainCommandRunner added in v0.8.12

type MainCommandRunner struct {
	Location string
	Askpass  *askpass.Server
}

func (*MainCommandRunner) RunCommand added in v0.8.12

func (a *MainCommandRunner) RunCommand(args []string, continuations ...tea.Cmd) tea.Cmd

func (*MainCommandRunner) RunCommandImmediate added in v0.8.12

func (a *MainCommandRunner) RunCommandImmediate(args []string) ([]byte, error)

func (*MainCommandRunner) RunCommandStreaming added in v0.8.12

func (a *MainCommandRunner) RunCommandStreaming(ctx context.Context, args []string) (*StreamingCommand, error)

func (*MainCommandRunner) RunInteractiveCommand added in v0.8.12

func (a *MainCommandRunner) RunInteractiveCommand(args []string, continuation tea.Cmd) tea.Cmd

type MainContext

type MainContext struct {
	CommandRunner
	SelectedItem   SelectedItem   // Single item where cursor is hover.
	CheckedItems   []SelectedItem // Items checked ✓ by the user.
	Location       string
	CustomCommands map[string]CustomCommand
	Leader         LeaderMap
	JJConfig       *config.JJConfig
	DefaultRevset  string
	CurrentRevset  string
	Histories      *config.Histories
}

func NewAppContext

func NewAppContext(location string, aps *askpass.Server) *MainContext

func (*MainContext) AddCheckedItem added in v0.9.1

func (ctx *MainContext) AddCheckedItem(item SelectedItem)

func (*MainContext) ClearCheckedItems added in v0.9.1

func (ctx *MainContext) ClearCheckedItems(ofType reflect.Type)

func (*MainContext) CreateReplacements added in v0.9.0

func (ctx *MainContext) CreateReplacements() map[string]string

CreateReplacements context aware replacements for custom commands and exec input.

func (*MainContext) GetSelectedRevisions added in v0.9.2

func (ctx *MainContext) GetSelectedRevisions() map[string]bool

func (*MainContext) RemoveCheckedItem added in v0.9.1

func (ctx *MainContext) RemoveCheckedItem(item SelectedItem)

func (*MainContext) SetSelectedItem

func (ctx *MainContext) SetSelectedItem(item SelectedItem) tea.Cmd

func (*MainContext) ToggleCheckedItem added in v0.9.2

func (ctx *MainContext) ToggleCheckedItem(item SelectedRevision)

type SelectedFile

type SelectedFile struct {
	ChangeId string
	CommitId string
	File     string
}

func (SelectedFile) Equal added in v0.8.1

func (s SelectedFile) Equal(other SelectedItem) bool

type SelectedItem

type SelectedItem interface {
	Equal(other SelectedItem) bool
}

type SelectedOperation added in v0.8.1

type SelectedOperation struct {
	OperationId string
}

func (SelectedOperation) Equal added in v0.8.1

func (s SelectedOperation) Equal(other SelectedItem) bool

type SelectedRevision

type SelectedRevision struct {
	ChangeId string
	CommitId string
}

func (SelectedRevision) Equal added in v0.8.1

func (s SelectedRevision) Equal(other SelectedItem) bool

type StreamingCommand added in v0.8.12

type StreamingCommand struct {
	io.ReadCloser
	ErrPipe io.ReadCloser
	// contains filtered or unexported fields
}

func (*StreamingCommand) Close added in v0.8.12

func (c *StreamingCommand) Close() error

func (*StreamingCommand) Wait added in v0.9.8

func (c *StreamingCommand) Wait() error

Jump to

Keyboard shortcuts

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