(path string)
| 16 | ) |
| 17 | |
| 18 | func Load(path string) error { |
| 19 | log.Debug("loading plugins from %s ...", path) |
| 20 | return fs.Glob(path, "*.js", func(fileName string) error { |
| 21 | if err, plugin := LoadPlugin(fileName); err != nil { |
| 22 | return fmt.Errorf("error while loading plugin '%s': %s", fileName, err) |
| 23 | } else if taken, found := plugins[plugin.Name]; found { |
| 24 | return fmt.Errorf("plugin '%s' has name %s which is already taken by '%s'", fileName, plugin.Name, taken.Path) |
| 25 | } else { |
| 26 | plugins[plugin.Name] = plugin |
| 27 | } |
| 28 | return nil |
| 29 | }) |
| 30 | } |
| 31 | |
| 32 | func Get(sh models.Shell) *Plugin { |
| 33 | return plugins[sh.Type] |
no test coverage detected