open-vault/vendor/github.com/posener/complete/predict_set.go
Jeff Mitchell e553fe0d99 Bump deps
2017-07-18 10:15:54 -04:00

20 lines
411 B
Go

package complete
import "github.com/posener/complete/match"
// PredictSet expects specific set of terms, given in the options argument.
func PredictSet(options ...string) Predictor {
return predictSet(options)
}
type predictSet []string
func (p predictSet) Predict(a Args) (prediction []string) {
for _, m := range p {
if match.Prefix(m, a.Last) {
prediction = append(prediction, m)
}
}
return
}