Implemented a package manager to remove plugins

This commit is contained in:
2021-10-09 18:03:04 +04:00
parent fc5e834552
commit 9f304d26c1
4 changed files with 57 additions and 2 deletions

View File

@@ -93,6 +93,24 @@ func DetectPlugins()(*Plugins,error){
return plugins,nil
}
// SearchPlugin Detects plugin information based on the
// name provided on the parameter
func SearchPlugin(pluginname string) (*Plugin,error) {
plugins, err := DetectPlugins()
if err != nil {
return nil, err
}
// loop ot find the plugin name that matches
for _, plugin := range plugins.PluginsDetected {
if pluginname == plugin.FolderName {
return plugin, nil
}
}
return nil, errors.New("plugin not detected")
}
// RunPlugin Executes plugins based on the plugin name provided
func RunPlugin(pluginName string ,IPAddresses []*ExecuteIP) (*Plugin,error) {
plugins, err := DetectPlugins()