Raxol.Core.Runtime.Plugins.CommandRegistry (Raxol v0.5.0)

View Source

Manages command registration and execution for plugins.

Summary

Functions

Executes a command with proper error handling and timeout.

Looks up the handler for a command name and namespace (plugin module). Returns {:ok, {module, function, arity}} or {:error, :not_found}.

Unregisters all commands for a plugin.

Types

command()

@type command() :: {command_name(), command_handler(), command_metadata()}

command_handler()

@type command_handler() :: function()

command_metadata()

@type command_metadata() :: %{
  optional(:description) => String.t(),
  optional(:usage) => String.t(),
  optional(:aliases) => [String.t()],
  optional(:timeout) => non_neg_integer()
}

command_name()

@type command_name() :: String.t()

Functions

execute_command(command_name, args, command_table)

Executes a command with proper error handling and timeout.

find_command(command_name, command_table)

Looks up the handler for a command name and namespace (plugin module). Returns {:ok, {module, function, arity}} or {:error, :not_found}.

register_plugin_commands(plugin_module, plugin_state, command_table)

Registers commands for a plugin.

unregister_plugin_commands(plugin_module, command_table)

Unregisters all commands for a plugin.