Documentation ¶
Index ¶
- Constants
- func AddDisplayString(c compromise.Candidate, bwr stringWriter)
- type CommandLine
- func (c *CommandLine) AdvancePc(n int)
- func (c *CommandLine) AfterCursor() bool
- func (c *CommandLine) AtCursor() bool
- func (c *CommandLine) BeforeCursor() bool
- func (c *CommandLine) Command() string
- func (c *CommandLine) CursorIndex() int
- func (c *CommandLine) Pc() int
- func (c *CommandLine) RawCommand() string
- func (c *CommandLine) RawWordAt(offset int) string
- func (c *CommandLine) RawWordAtCursor(offset int) string
- func (c *CommandLine) RawWordAtIndex(i int) string
- func (c *CommandLine) RawWords() []string
- func (c *CommandLine) Replace(cursorIndex int, rawWords []string) *CommandLine
- func (c *CommandLine) SetPc(n int)
- func (c *CommandLine) WordAt(offset int) string
- func (c *CommandLine) WordAtCursor(offset int) string
- func (c *CommandLine) WordAtIndex(i int) string
- func (c *CommandLine) WordLen() int
- type ShellAdapter
Constants ¶
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) Replace ¶
func (c *CommandLine) Replace(cursorIndex int, rawWords []string) *CommandLine
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