certbotbot
Reference documentation for a modular Bash project
Loading...
Searching...
No Matches
Functions
plugin-registry.bash File Reference

Provides the stable registry used by automatically discovered plugins. More...

Functions

int bash_starter_plugin_register (String name, String function_name, String description)
 Registers one plugin implementation with the runtime registry.
 
int bash_starter_plugin_list ()
 Prints registered plugins and their descriptions.
 
int bash_starter_plugin_run (String name, String arg)
 Dispatches execution to a registered plugin by logical name.
 

Detailed Description

Provides the stable registry used by automatically discovered plugins.

The build appends plugin files after this core module in deterministic lexical order. Each plugin registers a logical name, a human-readable description, and the function that implements the plugin. Runtime dispatch therefore depends on registry state rather than a central list of known plugin names.

The registry deliberately owns only discovery metadata and dispatch. A real project may add richer capability metadata, lifecycle hooks, or typed plugin categories, but those additions should extend this narrow contract rather than introduce plugin-specific branches into unrelated core code.

Function Documentation

◆ bash_starter_plugin_list()

int bash_starter_plugin_list ( )

Prints registered plugins and their descriptions.

Plugins are emitted in registration order. The build sorts plugin source paths lexically, making this output deterministic for a given source tree.

Standard Output
One tab-separated plugin name and description per line.
Return values
0The registry was printed successfully.
Examples
int bash_starter_plugin_list()
Prints registered plugins and their descriptions.

◆ bash_starter_plugin_register()

int bash_starter_plugin_register ( String  name,
String  function_name,
String  description 
)

Registers one plugin implementation with the runtime registry.

Registration is explicit even though source discovery is automatic. This gives each plugin control over its public logical name while keeping the build independent of a hard-coded plugin inventory. Duplicate names are rejected because silent replacement would make behavior depend on lexical file order.

Parameters
nameStable logical plugin name exposed to callers.
function_nameBash function that implements the plugin.
descriptionHuman-readable one-line plugin description.
Return values
0The plugin was registered.
64A required argument was empty or the name was already registered.
Examples
bash_starter_plugin_register "noop" "bash_starter_plugin_noop" "Do nothing"
int bash_starter_plugin_register(String name, String function_name, String description)
Registers one plugin implementation with the runtime registry.

◆ bash_starter_plugin_run()

int bash_starter_plugin_run ( String  name,
String  arg 
)

Dispatches execution to a registered plugin by logical name.

The dispatcher validates registry membership before performing an associative array lookup. Bash treats an empty associative-array subscript as an error, so the explicit empty-name guard is part of the public invalid-input contract, not merely defensive decoration. Valid calls invoke the registered function with all remaining arguments unchanged.

Parameters
nameLogical plugin name.
argArguments forwarded to the plugin implementation.
Return values
0The selected plugin completed successfully.
69No plugin with the requested name is registered.
Examples
int bash_starter_plugin_run(String name, String arg)
Dispatches execution to a registered plugin by logical name.