mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
20 lines
411 B
Go
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
|
|
}
|