Bug Fixes and cleanup

This commit is contained in:
Matt Dunleavy
2024-07-06 04:27:01 -04:00
parent b680745e16
commit a072069a5c
8 changed files with 41 additions and 15 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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 (

View File

@@ -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"

View File

@@ -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 (

View File

@@ -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

View File

@@ -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 (

View File

@@ -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 (