summaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/terraform/vendor/github.com/posener/complete/predict_set.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/vendor/github.com/posener/complete/predict_set.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/vendor/github.com/posener/complete/predict_set.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/vendor/github.com/posener/complete/predict_set.go b/vendor/github.com/hashicorp/terraform/vendor/github.com/posener/complete/predict_set.go
new file mode 100644
index 00000000..8fc59d71
--- /dev/null
+++ b/vendor/github.com/hashicorp/terraform/vendor/github.com/posener/complete/predict_set.go
@@ -0,0 +1,19 @@
+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
+}