diff options
author | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
---|---|---|
committer | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
commit | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/posener/complete/match | |
parent | 07971ca38143c5faf951d152fba370ddcbe26ad5 (diff) | |
download | terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip |
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/github.com/posener/complete/match')
-rw-r--r-- | vendor/github.com/posener/complete/match/file.go | 19 | ||||
-rw-r--r-- | vendor/github.com/posener/complete/match/match.go | 6 | ||||
-rw-r--r-- | vendor/github.com/posener/complete/match/prefix.go | 9 |
3 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/posener/complete/match/file.go b/vendor/github.com/posener/complete/match/file.go new file mode 100644 index 0000000..051171e --- /dev/null +++ b/vendor/github.com/posener/complete/match/file.go | |||
@@ -0,0 +1,19 @@ | |||
1 | package match | ||
2 | |||
3 | import "strings" | ||
4 | |||
5 | // File returns true if prefix can match the file | ||
6 | func File(file, prefix string) bool { | ||
7 | // special case for current directory completion | ||
8 | if file == "./" && (prefix == "." || prefix == "") { | ||
9 | return true | ||
10 | } | ||
11 | if prefix == "." && strings.HasPrefix(file, ".") { | ||
12 | return true | ||
13 | } | ||
14 | |||
15 | file = strings.TrimPrefix(file, "./") | ||
16 | prefix = strings.TrimPrefix(prefix, "./") | ||
17 | |||
18 | return strings.HasPrefix(file, prefix) | ||
19 | } | ||
diff --git a/vendor/github.com/posener/complete/match/match.go b/vendor/github.com/posener/complete/match/match.go new file mode 100644 index 0000000..812fcac --- /dev/null +++ b/vendor/github.com/posener/complete/match/match.go | |||
@@ -0,0 +1,6 @@ | |||
1 | package match | ||
2 | |||
3 | // Match matches two strings | ||
4 | // it is used for comparing a term to the last typed | ||
5 | // word, the prefix, and see if it is a possible auto complete option. | ||
6 | type Match func(term, prefix string) bool | ||
diff --git a/vendor/github.com/posener/complete/match/prefix.go b/vendor/github.com/posener/complete/match/prefix.go new file mode 100644 index 0000000..9a01ba6 --- /dev/null +++ b/vendor/github.com/posener/complete/match/prefix.go | |||
@@ -0,0 +1,9 @@ | |||
1 | package match | ||
2 | |||
3 | import "strings" | ||
4 | |||
5 | // Prefix is a simple Matcher, if the word is it's prefix, there is a match | ||
6 | // Match returns true if a has the prefix as prefix | ||
7 | func Prefix(long, prefix string) bool { | ||
8 | return strings.HasPrefix(long, prefix) | ||
9 | } | ||