From 010e7ab3898e3d9b2f3051dd82b2a4a5de02e964 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Tue, 2 Jul 2019 14:59:19 +0100 Subject: [PATCH] Export IsInstalled() in install package --- cmd/install/install.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 {