adapters

package
v0.0.0-...-e19543c Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvokeOption = "compromise-complete"
)

Variables

This section is empty.

Functions

func AddDisplayString

func AddDisplayString(c compromise.Candidate, bwr stringWriter)

Types

type CommandLine

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

CommandLine holds the words in the command line and other contextual information.

func (*CommandLine) AdvancePc

func (c *CommandLine) AdvancePc(n int)

AdvancePc increments pc by n.

func (*CommandLine) AfterCursor

func (c *CommandLine) AfterCursor() bool

AfterCursor returns whether pc is after the cursor index.

func (*CommandLine) AtCursor

func (c *CommandLine) AtCursor() bool

AtCursor returns whether pc is equal to the cursor index.

func (*CommandLine) BeforeCursor

func (c *CommandLine) BeforeCursor() bool

BeforeCursor returns whether pc is before the cursor index.

func (*CommandLine) Command

func (c *CommandLine) Command() string

Command returns the unescaped target executable command name.

func (*CommandLine) CursorIndex

func (c *CommandLine) CursorIndex() int

CursorIndex returns the index of the word at the cursor.

func (*CommandLine) Pc

func (c *CommandLine) Pc() int

Pc returns the current pc (program counter).

func (*CommandLine) RawCommand

func (c *CommandLine) RawCommand() string

RawCommand returns the raw target executable command name.

func (*CommandLine) RawWordAt

func (c *CommandLine) RawWordAt(offset int) string

RawWordAt returns the raw word at pc.

func (*CommandLine) RawWordAtCursor

func (c *CommandLine) RawWordAtCursor(offset int) string

RawWordAtCursor returns the raw word at cursor.

func (*CommandLine) RawWordAtIndex

func (c *CommandLine) RawWordAtIndex(i int) string

RawWordAtIndex returns the raw word at a given index (0-based).

func (*CommandLine) RawWords

func (c *CommandLine) RawWords() []string

Return raw words.

func (*CommandLine) Replace

func (c *CommandLine) Replace(cursorIndex int, rawWords []string) *CommandLine

func (*CommandLine) SetPc

func (c *CommandLine) SetPc(n int)

SetPc set pc to n.

func (*CommandLine) WordAt

func (c *CommandLine) WordAt(offset int) string

WordAt returns the unescaped word at pc.

func (*CommandLine) WordAtCursor

func (c *CommandLine) WordAtCursor(offset int) string

WordAtCursor returns the unescaped word at cursor.

func (*CommandLine) WordAtIndex

func (c *CommandLine) WordAtIndex(i int) string

WordAtIndex returns the unescaped word at a given index (0-based).

func (*CommandLine) WordLen

func (c *CommandLine) WordLen() int

WordLen returns the number of words in the command line.

type ShellAdapter

type ShellAdapter interface {
	Install(targetCommandNames []string, spec string)
	HasMenuCompletion() bool
	UseFzf() bool

	Escape(arg string) string
	Unescape(arg string) string

	GetCommandLine(args []string) *CommandLine

	StartCompletion(commandLine *CommandLine)
	MaybeOverrideCandidates(commandLine *CommandLine) []compromise.Candidate
	AddCandidate(candidate compromise.Candidate)

	EndCompletion()
	Finish()

	DefaultMaxCandidates() int
	DefaultMaxHelps() int
}

func GetShellAdapter

func GetShellAdapter(rd io.Reader, wr io.Writer) ShellAdapter

Jump to

Keyboard shortcuts

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