completer

package
v0.0.0-...-0798a42 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteFunc

type CompleteFunc func(string) ([]string, string)

A CompleteFunc accepts a string to be completed and returns a slice of completions candidates with a prefix to prepend to the chosen candidate

type Completer

type Completer struct {
	// AddressBookCmd is the command to run for completing email addresses. This
	// command must output one completion on each line with fields separated by a
	// tab character. The first field must be the address, and the second field,
	// if present, the contact name. Only the email address field is required.
	// The name field is optional. Additional fields are ignored.
	AddressBookCmd string
	// contains filtered or unexported fields
}

A Completer is used to autocomplete text inputs based on the configured completion commands.

func New

func New(addressBookCmd string, errHandler func(error)) *Completer

New creates a new Completer with the specified address book command.

func (*Completer) ForHeader

func (c *Completer) ForHeader(h string) CompleteFunc

ForHeader returns a CompleteFunc appropriate for the specified mail header. In the case of To, From, etc., the completer will get completions from the configured address book command. For other headers, a noop completer will be returned. If errors arise during completion, the errHandler will be called.

Jump to

Keyboard shortcuts

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