Documentation ¶
Overview ¶
Package predict provides helper functions for completion predictors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Something is used to indicate that does not completes somthing. Such that other prediction // wont be applied. Something = Set{""} // Nothing is used to indicate that does not completes anything. Nothing = Set{} )
Functions ¶
Types ¶
type Config ¶
Config stores prediction options.
type FilesPredictor ¶
type FilesPredictor struct {
// contains filtered or unexported fields
}
func Dirs ¶
func Dirs(pattern string) FilesPredictor
Dirs returns a predictor that predict directory paths. If a non-empty pattern is given, the predicted paths will match that pattern.
func Files ¶
func Files(pattern string) FilesPredictor
Dirs returns a predictor that predict file or directory paths. If a non-empty pattern is given, the predicted paths will match that pattern.
func (FilesPredictor) Predict ¶
func (f FilesPredictor) Predict(prefix string) (options []string)
Predict searches for files according to the given prefix. If the only predicted path is a single directory, the search will continue another recursive layer into that directory.
type FilesSet ¶
type FilesSet []string
FilesSet predict according to file rules to a given fixed set of file names.
type Option ¶
type Option func(*Config)
Option provides prediction through options pattern.
Usage:
func(o ...predict.Option) { cfg := predict.Options(o) // use cfg.Predict... }
func OptPredictor ¶
OptPredictor allows to set a custom predictor.