diff options
| author | Eyal Posener <[email protected]> | 2019-07-02 17:15:36 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-07-02 17:15:36 +0300 |
| commit | 6ffe496ea9530c0638974624ed9dd429f9ad592e (patch) | |
| tree | ab8915a8fe31c745c70c760040b28936014a724f | |
| parent | 33efd44daa11a504c05c66f2b61211876f6e0b28 (diff) | |
| parent | 010e7ab3898e3d9b2f3051dd82b2a4a5de02e964 (diff) | |
Merge pull request #96 from vadmeste/add-api
Export IsInstalled() in install package
| -rw-r--r-- | cmd/install/install.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/install/install.go b/cmd/install/install.go index a9a01d4..884c23f 100644 --- a/cmd/install/install.go +++ b/cmd/install/install.go @@ -38,6 +38,24 @@ func Install(cmd string) error { return err } +// IsInstalled returns true if the completion +// for the given cmd is installed. +func IsInstalled(cmd string) bool { + bin, err := getBinaryPath() + if err != nil { + return false + } + + for _, i := range installers() { + installed := i.IsInstalled(cmd, bin) + if installed { + return true + } + } + + return false +} + // Uninstall complete command given: // cmd: is the command name func Uninstall(cmd string) error { |
