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

View Source

Defines the behaviour for plugin command registration and dispatch.

This behaviour is responsible for:

  • Finding plugins for command handling
  • Registering plugin commands
  • Handling command dispatch
  • Managing command unregistration

Summary

Callbacks

Finds the plugin responsible for handling a command.

Handles the dispatching of a command to the appropriate plugin.

Registers the commands exposed by a plugin.

Unregisters all commands associated with a specific plugin module.

Callbacks

find_plugin_for_command(command_table, command_name, namespace, arity)

@callback find_plugin_for_command(
  command_table :: atom(),
  command_name :: String.t(),
  namespace :: atom() | nil,
  arity :: integer() | :unknown
) :: {:ok, {module(), atom(), integer()}} | :not_found

Finds the plugin responsible for handling a command.

handle_command(command_table, command_name_str, namespace, args, state)

@callback handle_command(
  command_table :: atom(),
  command_name_str :: String.t(),
  namespace :: atom() | nil,
  args :: list(),
  state :: map()
) :: {:ok, map()} | :not_found | {:error, any()}

Handles the dispatching of a command to the appropriate plugin.

register_plugin_commands(plugin_module, plugin_state, command_table)

@callback register_plugin_commands(
  plugin_module :: module(),
  plugin_state :: map(),
  command_table :: atom()
) :: :ok

Registers the commands exposed by a plugin.

unregister_plugin_commands(command_table, plugin_module)

@callback unregister_plugin_commands(
  command_table :: atom(),
  plugin_module :: module()
) :: :ok

Unregisters all commands associated with a specific plugin module.