Raxol.Core.Runtime.Plugins.CommandHelper.Behaviour behaviour (Raxol v0.3.0)

View Source

Defines the behaviour for plugin command management.

This behaviour is responsible for:

  • Registering plugin commands
  • Managing command handlers
  • Validating command specifications
  • Handling command execution

Summary

Callbacks

Gets all registered commands for a plugin.

Unregisters commands for a plugin.

Validates a plugin's command specifications.

Callbacks

execute_command(command, args, plugin_module, plugin_state)

@callback execute_command(
  command :: atom(),
  args :: list(),
  plugin_module :: module(),
  plugin_state :: map()
) :: {:ok, map()} | {:error, any()}

Executes a command for a plugin.

get_plugin_commands(plugin_id, command_table)

@callback get_plugin_commands(
  plugin_id :: String.t(),
  command_table :: atom()
) :: {:ok, [map()]} | {:error, any()}

Gets all registered commands for a plugin.

register_plugin_commands(plugin_module, plugin_state, command_table)

@callback register_plugin_commands(
  plugin_module :: module(),
  plugin_state :: map(),
  command_table :: atom()
) :: :ok | {:error, any()}

Registers commands for a plugin.

unregister_plugin_commands(plugin_id, command_table)

@callback unregister_plugin_commands(
  plugin_id :: String.t(),
  command_table :: atom()
) :: :ok | {:error, any()}

Unregisters commands for a plugin.

validate_commands(commands)

@callback validate_commands(commands :: [map()]) :: :ok | {:error, any()}

Validates a plugin's command specifications.