4 "github.com/posener/complete/cmd/install"
7 // autocompleteInstaller is an interface to be implemented to perform the
8 // autocomplete installation and uninstallation with a CLI.
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.
12 type autocompleteInstaller interface {
14 Uninstall(string) error
17 // realAutocompleteInstaller uses the real install package to do the
19 type realAutocompleteInstaller struct{}
21 func (i *realAutocompleteInstaller) Install(cmd string) error {
22 return install.Install(cmd)
25 func (i *realAutocompleteInstaller) Uninstall(cmd string) error {
26 return install.Uninstall(cmd)
29 // mockAutocompleteInstaller is used for tests to record the install/uninstall.
30 type mockAutocompleteInstaller struct {
35 func (i *mockAutocompleteInstaller) Install(cmd string) error {
36 i.InstallCalled = true
40 func (i *mockAutocompleteInstaller) Uninstall(cmd string) error {
41 i.UninstallCalled = true