Raxol.Core.Runtime.Plugins.Commands (Raxol v0.2.0)
View SourceHandles registration and execution of commands provided by plugins.
This module maintains a registry of commands provided by plugins and integrates them with the main command execution system. It ensures that plugin commands are properly isolated and cannot interfere with core system functionality.
Summary
Functions
Returns a specification to start this module under a supervisor.
Execute a plugin command with the given arguments.
Get help text for a specific command.
List all registered plugin commands.
Register a new command provided by a plugin.
Start the plugin commands registry.
Unregister a previously registered command.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Execute a plugin command with the given arguments.
Parameters
command_name
- The name of the command to executeargs
- Arguments to pass to the commandcontext
- Execution context for the command
Returns
{:ok, result}
if execution was successful{:error, reason}
if execution failed
Get help text for a specific command.
Parameters
command_name
- The name of the command
Returns
{:ok, help_text}
if command exists{:error, :not_found}
if command does not exist
@spec list_commands() :: map()
List all registered plugin commands.
Returns
Map with command names as keys and metadata as values
Register a new command provided by a plugin.
Parameters
command_name
- The name of the command (should be prefixed with plugin namespace)handler
- Module that will handle the commandhelp_text
- Help text to display for the commandoptions
- Additional options for command registration
Returns
:ok
if command was registered{:error, :already_registered}
if command name is already in use{:error, reason}
for other errors
Start the plugin commands registry.
Unregister a previously registered command.
Parameters
command_name
- The name of the command to unregister
Returns
:ok
if command was unregistered{:error, :not_found}
if command was not registered