Raxol.Core.Runtime.Plugins.PluginCommandRegistry.Behaviour behaviour (Raxol v0.4.0)

View Source

Defines the behaviour for plugin command registration.

This behaviour is responsible for:

  • Registering plugin commands
  • Managing command lookups
  • Handling command unregistration
  • Maintaining command metadata

Summary

Callbacks

Looks up the handler for a command name and namespace.

Creates a new command registry table. Returns the name of the created table.

Unregisters all commands associated with a specific module.

Types

command_entry()

@type command_entry() :: {module(), atom(), integer() | nil}

command_key()

@type command_key() :: {namespace(), command_name()}

command_name()

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

namespace()

@type namespace() :: atom() | nil

table_name()

@type table_name() :: atom()

Callbacks

lookup_command(table_name, namespace, command_name)

@callback lookup_command(
  table_name(),
  namespace(),
  command_name()
) :: {:ok, command_entry()} | {:error, :not_found}

Looks up the handler for a command name and namespace.

new()

@callback new() :: table_name()

Creates a new command registry table. Returns the name of the created table.

register_command(table_name, namespace, command_name, module, atom, arg6)

@callback register_command(
  table_name(),
  namespace(),
  command_name(),
  module(),
  atom(),
  integer() | nil
) :: :ok | {:error, :already_registered}

Registers a command provided by a plugin.

unregister_command(table_name, namespace, command_name)

@callback unregister_command(
  table_name(),
  namespace(),
  command_name()
) :: :ok

Unregisters a command.

unregister_commands_by_module(table_name, module)

@callback unregister_commands_by_module(
  table_name(),
  module()
) :: :ok

Unregisters all commands associated with a specific module.