Documentation
¶
Index ¶
- type Command
- type Event
- type EventType
- type KeyBinding
- type Manager
- func (m *Manager) GetAllPlugins() []Plugin
- func (m *Manager) GetCommands() []Command
- func (m *Manager) GetKeyBindings() []KeyBinding
- func (m *Manager) GetPlugin(name string) Plugin
- func (m *Manager) GetViews() []View
- func (m *Manager) LoadPlugin(path string) error
- func (m *Manager) LoadPluginsFromDirectory(dir string) error
- func (m *Manager) SendEvent(event Event) error
- func (m *Manager) UnloadAllPlugins() error
- func (m *Manager) UnloadPlugin(name string) error
- type Plugin
- type PluginInfo
- type PluginManager
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Name string
Description string
Usage string
Handler func(args []string) error
}
Command represents a plugin command
type Event ¶
type Event struct {
Type EventType
Data interface{}
}
Event represents various events in the application
type KeyBinding ¶
KeyBinding represents a custom key binding
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements the PluginManager interface
func NewManager ¶
func NewManager(ctx context.Context, client dao.SlurmClient) *Manager
NewManager creates a new plugin manager
func (*Manager) GetAllPlugins ¶
GetAllPlugins returns all loaded plugins
func (*Manager) GetCommands ¶
GetCommands returns all commands from all plugins
func (*Manager) GetKeyBindings ¶
func (m *Manager) GetKeyBindings() []KeyBinding
GetKeyBindings returns all key bindings from all plugins
func (*Manager) LoadPlugin ¶
LoadPlugin loads a plugin from the given path
func (*Manager) LoadPluginsFromDirectory ¶
LoadPluginsFromDirectory loads all plugins from a directory
func (*Manager) UnloadAllPlugins ¶
UnloadAllPlugins unloads all plugins
func (*Manager) UnloadPlugin ¶
UnloadPlugin unloads a plugin
type Plugin ¶
type Plugin interface {
// GetInfo returns basic plugin information
GetInfo() PluginInfo
// Initialize initializes the plugin with the given context and client
Initialize(ctx context.Context, client dao.SlurmClient) error
// GetCommands returns the commands this plugin provides
GetCommands() []Command
// GetViews returns the views this plugin provides
GetViews() []View
// GetKeyBindings returns custom key bindings this plugin provides
GetKeyBindings() []KeyBinding
// OnEvent is called when various events occur in the application
OnEvent(event Event) error
// Cleanup is called when the plugin is being unloaded
Cleanup() error
}
Plugin represents a s9s plugin
type PluginInfo ¶
type PluginInfo struct {
Name string
Version string
Description string
Author string
Website string
}
PluginInfo contains basic information about a plugin
type PluginManager ¶
type PluginManager interface {
// LoadPlugin loads a plugin from the given path
LoadPlugin(path string) error
// LoadPluginsFromDirectory loads all plugins from a directory
LoadPluginsFromDirectory(dir string) error
// GetPlugin returns a plugin by name
GetPlugin(name string) Plugin
// GetAllPlugins returns all loaded plugins
GetAllPlugins() []Plugin
// GetCommands returns all commands from all plugins
GetCommands() []Command
// GetViews returns all views from all plugins
GetViews() []View
// GetKeyBindings returns all key bindings from all plugins
GetKeyBindings() []KeyBinding
// SendEvent sends an event to all plugins
SendEvent(event Event) error
// UnloadPlugin unloads a plugin
UnloadPlugin(name string) error
// UnloadAllPlugins unloads all plugins
UnloadAllPlugins() error
}
PluginManager manages all loaded plugins
type View ¶
type View interface {
// GetName returns the view name
GetName() string
// GetTitle returns the view title
GetTitle() string
// Render returns the tview primitive for this view
Render() tview.Primitive
// OnKey handles key events
OnKey(event *tcell.EventKey) *tcell.EventKey
// Refresh updates the view data
Refresh() error
// Init initializes the view
Init(ctx context.Context) error
}
View represents a plugin-provided view