Raxol.Terminal.Plugin.Manager (Raxol v0.5.0)

View Source

Manages terminal plugins with advanced features:

  • Plugin loading and unloading
  • Plugin lifecycle management
  • Plugin API and hooks
  • Plugin configuration and state management

Summary

Functions

Calls a hook with the given arguments.

Gets the current plugin metrics.

Loads a plugin into the manager.

Creates a new plugin manager with the given options.

Unloads a plugin from the manager.

Updates the configuration for a plugin.

Types

hook()

@type hook() :: %{name: String.t(), callback: function(), priority: integer()}

plugin()

@type plugin() :: %{
  name: String.t(),
  version: String.t(),
  description: String.t(),
  author: String.t(),
  hooks: [String.t()],
  config: map(),
  state: map()
}

t()

@type t() :: %Raxol.Terminal.Plugin.Manager{
  config: map(),
  hooks: %{required(String.t()) => [hook()]},
  metrics: %{
    plugin_loads: integer(),
    plugin_unloads: integer(),
    hook_calls: integer(),
    config_updates: integer()
  },
  plugins: %{required(String.t()) => plugin()}
}

Functions

call_hook(manager, hook_name, args \\ [])

@spec call_hook(t(), String.t(), [term()]) :: {:ok, [term()], t()} | {:error, term()}

Calls a hook with the given arguments.

get_metrics(manager)

@spec get_metrics(t()) :: map()

Gets the current plugin metrics.

load_plugin(manager, plugin)

@spec load_plugin(t(), plugin()) :: {:ok, t()} | {:error, term()}

Loads a plugin into the manager.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new plugin manager with the given options.

unload_plugin(manager, plugin_name)

@spec unload_plugin(t(), String.t()) :: {:ok, t()} | {:error, term()}

Unloads a plugin from the manager.

update_plugin_config(manager, plugin_name, config)

@spec update_plugin_config(t(), String.t(), map()) :: {:ok, t()} | {:error, term()}

Updates the configuration for a plugin.