Merge pull request #96 from vadmeste/add-api

Export IsInstalled() in install package
This commit is contained in:
Eyal Posener 2019-07-02 17:15:36 +03:00 committed by GitHub
commit 6ffe496ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -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 {