Give plugins a handle to their plugin loader

This potentially allows plugins to invoke other plugins.
This commit is contained in:
Austin Roberts 2021-07-12 14:55:45 -05:00
parent 6e4c285ed1
commit c45774b74b

View File

@ -113,12 +113,12 @@ func Initialize(target string, ctx *cli.Context) (err error) {
func (pl *PluginLoader) Initialize(ctx *cli.Context) {
fns := pl.Lookup("Initialize", func(i interface{}) bool {
_, ok := i.(func(*cli.Context) error)
_, ok := i.(func(*cli.Context, *PluginLoader) error)
return ok
})
for _, fni := range fns {
if fn, ok := fni.(func(*cli.Context)); ok {
fn(ctx)
if fn, ok := fni.(func(*cli.Context, *PluginLoader)); ok {
fn(ctx, pl)
}
}
}