Adds support to a tree hierarchy of kubectl plugins
This commit is contained in:
@@ -88,8 +88,15 @@ func (l *DirectoryPluginLoader) Load() (Plugins, error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
plugin.Dir = filepath.Dir(path)
|
||||
plugin.DescriptorName = fileInfo.Name()
|
||||
var setSource func(path string, fileInfo os.FileInfo, p *Plugin)
|
||||
setSource = func(path string, fileInfo os.FileInfo, p *Plugin) {
|
||||
p.Dir = filepath.Dir(path)
|
||||
p.DescriptorName = fileInfo.Name()
|
||||
for _, child := range p.Tree {
|
||||
setSource(path, fileInfo, child)
|
||||
}
|
||||
}
|
||||
setSource(path, fileInfo, plugin)
|
||||
|
||||
glog.V(6).Infof("Plugin loaded: %s", plugin.Name)
|
||||
list = append(list, plugin)
|
||||
|
Reference in New Issue
Block a user