mirror of
https://github.com/matt-dunleavy/plugin-manager.git
synced 2025-09-27 01:25:52 +08:00
Bug Fixes and cleanup
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2024 Matt Dunleavy <matt@dunleavy.co>
|
||||
Copyright (C) 2024 Matt Dunleavy <matt@excedra.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
30
README.md
30
README.md
@@ -1,6 +1,6 @@
|
||||
# Go Plugin Manager
|
||||
# Plugin Manager for Go
|
||||
|
||||
A robust and flexible plugin management system for Go applications.
|
||||
A flexible and robust plugin management system for Go applications.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -83,8 +83,9 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
// Create a new plugin manager
|
||||
manager, err := pm.NewManager("config.json", "./plugins")
|
||||
manager, err := pm.NewManager("plugins.json", "./plugins")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create plugin manager: %v", err)
|
||||
}
|
||||
@@ -122,7 +123,7 @@ func main() {
|
||||
|
||||
## Configuration
|
||||
|
||||
The plugin manager uses a JSON configuration file to keep track of enabled plugins. Here's an example `config.json`:
|
||||
The plugin manager uses a JSON configuration file to keep track of enabled plugins. Here's an example `plugins.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -135,16 +136,19 @@ The plugin manager uses a JSON configuration file to keep track of enabled plugi
|
||||
|
||||
## API Reference
|
||||
|
||||
### Manager
|
||||
- ### Manager
|
||||
|
||||
- `NewManager(configPath string, pluginDir string) (*Manager, error)`
|
||||
- `LoadPlugin(path string) error`
|
||||
- `UnloadPlugin(name string) error`
|
||||
- `ExecutePlugin(name string) error`
|
||||
- `HotReload(name string, path string) error`
|
||||
- `EnablePlugin(name string) error`
|
||||
- `DisablePlugin(name string) error`
|
||||
- `LoadEnabledPlugins(pluginDir string) error`
|
||||
- `NewManager(configPath string, pluginDir string) (*Manager, error)`
|
||||
- `LoadPlugin(path string) error`
|
||||
- `UnloadPlugin(name string) error`
|
||||
- `ExecutePlugin(name string) error`
|
||||
- `HotReload(name string, path string) error`
|
||||
- `EnablePlugin(name string) error`
|
||||
- `DisablePlugin(name string) error`
|
||||
- `LoadEnabledPlugins(pluginDir string) error`
|
||||
- `ListPlugins() []string`
|
||||
- `GetPluginStats(name string) (*PluginStats, error)`
|
||||
- `SubscribeToEvent(eventName string, handler EventHandler)`
|
||||
|
||||
### EventBus
|
||||
|
||||
|
@@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2024 Matt Dunleavy. All rights reserved.
|
||||
// Use of this source code is subject to the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package pluginmanager
|
||||
|
||||
import (
|
||||
|
@@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2024 Matt Dunleavy. All rights reserved.
|
||||
// Use of this source code is subject to the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package pluginmanager
|
||||
|
||||
import "errors"
|
||||
|
4
event.go
4
event.go
@@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2024 Matt Dunleavy. All rights reserved.
|
||||
// Use of this source code is subject to the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package pluginmanager
|
||||
|
||||
import (
|
||||
|
@@ -1,4 +1,6 @@
|
||||
// File: internal/plugin/manager.go
|
||||
// Copyright (C) 2024 Matt Dunleavy. All rights reserved.
|
||||
// Use of this source code is subject to the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package pluginmanager
|
||||
|
||||
|
@@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2024 Matt Dunleavy. All rights reserved.
|
||||
// Use of this source code is subject to the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package pluginmanager
|
||||
|
||||
import (
|
||||
|
@@ -1,3 +1,7 @@
|
||||
// Copyright (C) 2024 Matt Dunleavy. All rights reserved.
|
||||
// Use of this source code is subject to the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package pluginmanager
|
||||
|
||||
import (
|
||||
|
Reference in New Issue
Block a user