github.com/divan/complete@v0.0.0-20170515130636-337e95201af7/predict_set.go (about) 1 package complete 2 3 import "github.com/posener/complete/match" 4 5 // PredictSet expects specific set of terms, given in the options argument. 6 func PredictSet(options ...string) Predictor { 7 return predictSet(options) 8 } 9 10 type predictSet []string 11 12 func (p predictSet) Predict(a Args) (prediction []string) { 13 for _, m := range p { 14 if match.Prefix(m, a.Last) { 15 prediction = append(prediction, m) 16 } 17 } 18 return 19 }