aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/mitchellh/cli/autocomplete.go
diff options
context:
space:
mode:
authorAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
committerAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
commit15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch)
tree255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/mitchellh/cli/autocomplete.go
parent07971ca38143c5faf951d152fba370ddcbe26ad5 (diff)
downloadterraform-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/mitchellh/cli/autocomplete.go')
-rw-r--r--vendor/github.com/mitchellh/cli/autocomplete.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/cli/autocomplete.go b/vendor/github.com/mitchellh/cli/autocomplete.go
new file mode 100644
index 0000000..3bec625
--- /dev/null
+++ b/vendor/github.com/mitchellh/cli/autocomplete.go
@@ -0,0 +1,43 @@
1package cli
2
3import (
4 "github.com/posener/complete/cmd/install"
5)
6
7// autocompleteInstaller is an interface to be implemented to perform the
8// autocomplete installation and uninstallation with a CLI.
9//
10// This interface is not exported because it only exists for unit tests
11// to be able to test that the installation is called properly.
12type autocompleteInstaller interface {
13 Install(string) error
14 Uninstall(string) error
15}
16
17// realAutocompleteInstaller uses the real install package to do the
18// install/uninstall.
19type realAutocompleteInstaller struct{}
20
21func (i *realAutocompleteInstaller) Install(cmd string) error {
22 return install.Install(cmd)
23}
24
25func (i *realAutocompleteInstaller) Uninstall(cmd string) error {
26 return install.Uninstall(cmd)
27}
28
29// mockAutocompleteInstaller is used for tests to record the install/uninstall.
30type mockAutocompleteInstaller struct {
31 InstallCalled bool
32 UninstallCalled bool
33}
34
35func (i *mockAutocompleteInstaller) Install(cmd string) error {
36 i.InstallCalled = true
37 return nil
38}
39
40func (i *mockAutocompleteInstaller) Uninstall(cmd string) error {
41 i.UninstallCalled = true
42 return nil
43}