predict

package
v2.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 5 Imported by: 39

Documentation

Overview

Package predict provides helper functions for completion predictors.

Index

Constants

This section is empty.

Variables

View Source
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

func Or

func Or(ps ...complete.Predictor) complete.Predictor

Or unions prediction functions, so that the result predication is the union of their predications.

Types

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.

func (FilesSet) Predict

func (s FilesSet) Predict(prefix string) (prediction []string)

type Set

type Set []string

Set predicts a set of predefined values.

func (Set) Predict

func (p Set) Predict(_ string) (options []string)

Jump to

Keyboard shortcuts

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