Add plugin hook tester

This commit is contained in:
Austin Roberts
2021-08-25 14:00:27 -05:00
parent d2df0b4c5f
commit 40377543bf
2 changed files with 41 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package plugins
// type PluginLoader struct{
// Plugins []*plugin.Plugin
// Subcommands map[string]Subcommand
// Flags []*flag.FlagSet
// LookupCache map[string][]interface{}
// }
func HookTester(name string, fn interface{}) func() {
oldDefault := DefaultPluginLoader
DefaultPluginLoader = &PluginLoader{
LookupCache: map[string][]interface{}{
name: []interface{}{fn},
},
}
return func() { DefaultPluginLoader = oldDefault }
}