completion

package
v0.0.0-...-c0b29db Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomCompletion = map[string]CustomCompleter{
	"set":      &customComplete{Func: completionSet, Name: "Built-in `set` completer"},
	"cd":       &customComplete{Func: completionCd, Name: "Built-in `cd` completer"},
	"env":      &customComplete{Func: completionEnv, Name: "built-in `env` completer"},
	"which":    &customComplete{Func: completionWhich, Name: "built-in `which` completer"},
	"pushd":    &customComplete{Func: completionCd, Name: "Built-in `pushd` completer"},
	"rmdir":    &customComplete{Func: completionDir, Name: "Built-in `rmdir` completer"},
	"rd":       &customComplete{Func: completionDir, Name: "Built-in `rmdir` completer"},
	"killall":  &customComplete{Func: completionProcessName, Name: "Built-in `kill` completer"},
	"taskkill": &customComplete{Func: completionTaskKill, Name: "Built-in `taskkill` completer"},
	"start":    &customComplete{Func: completionStart, Name: "built-in `start` completer"},
}
View Source
var HookToList = []func(context.Context, *readline.Buffer, *List) (*List, error){}

HookToList is the slice for Completion-Hook functions for users.

View Source
var IncludeHidden = false
View Source
var PercentVariables = []IVariable{
	new(EnvironmentVariable),
}
View Source
var UseSlash = false

Functions

func AppendCommandLister

func AppendCommandLister(f func(context.Context) ([]Element, error))

AppendCommandLister is the function to append the environment variable name at seeing on command-name completion.

func CommonPrefix

func CommonPrefix(list []string) string

func DirName

func DirName(path string) string

DirName returns a directory-part from path, but do not clean up path.

func KeyFuncCompletion

func KeyFuncCompletion(ctx context.Context, this *readline.Buffer) readline.Result

Types

type CustomCompleter

type CustomCompleter interface {
	Complete(context.Context, UncCompletion, []string) ([]Element, error)
	String() string
}

type Element

type Element interface {
	String() string
	Display() string
}

func ListUpFiles

func ListUpFiles(ctx context.Context, ua UncCompletion, str string) ([]Element, error)

type Element1

type Element1 string

func (Element1) Display

func (s Element1) Display() string

func (Element1) String

func (s Element1) String() string

type Element2

type Element2 [2]string

func (Element2) Display

func (s Element2) Display() string

func (Element2) String

func (s Element2) String() string

type EnvironmentVariable

type EnvironmentVariable struct {
}

func (*EnvironmentVariable) EachKey

func (*EnvironmentVariable) EachKey(f func(name string))

func (*EnvironmentVariable) Lookup

func (*EnvironmentVariable) Lookup(name string) string

type IVariable

type IVariable interface {
	Lookup(name string) string
	EachKey(func(string))
}

type List

type List struct {
	AllLine string
	List    []Element
	RawWord string // have quotation
	Word    string
	Pos     int
	Field   []string
	Left    string
}

type UncCompletion

type UncCompletion int
const (
	DoNotUncCompletion UncCompletion = iota
	AskDoUncCompletion
	DoUncCompletion
)

Jump to

Keyboard shortcuts

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