aac.execute.plugin_runner¶
A simple data class to collect AaC command info from plugins.
Classes
|
A class used to represent a command in AaC. |
|
A class used to represent a command argument for an AaC command. |
|
A class used to manage the plugin execution invocation in AaC. |
- class aac.execute.plugin_runner.AacCommand(name: str, description: str, callback: Callable[[...], Any], arguments: list[AacCommandArgument] = NOTHING)[source]¶
A class used to represent a command in AaC.
The command name is added to the argument parser with help set to the command description. The callback is invoked if the user specifies the command.
- Parameters:
name (str)
description (str)
callback (Callable[[...], Any])
arguments (list[AacCommandArgument])
- name¶
A string with the name of the command.
- Type:
str
- description¶
A string with the command description – will be used to populate the help command.
- Type:
str
- callback¶
A function that’s executed when the user runs the AaC command.
- Type:
Callable[[…], Any]
- arguments¶
A list of AacCommandArgument containing argument information about the command. (default: [])
- Type:
- class aac.execute.plugin_runner.AacCommandArgument(name: str | list[str], description: str, data_type: str, default: Any = attr_dict['default'].default)[source]¶
A class used to represent a command argument for an AaC command.
- Parameters:
name (str | list[str])
description (str)
data_type (str)
default (Any)
- name¶
One or more strings with the name of the command argument.
- Type:
str | list[str]
- description¶
A string with the command argument description.
- Type:
str
- data_type¶
The data type of the command argument.
- Type:
str
- default¶
The default value for the current argument. (default: None)
- Type:
Any
- class aac.execute.plugin_runner.PluginRunner(plugin_definition: Definition, command_to_callback: dict[str, Callable] = attr_dict['command_to_callback'].default, constraint_to_callback: dict[str, Callable] = attr_dict['constraint_to_callback'].default)[source]¶
A class used to manage the plugin execution invocation in AaC.
Each plugin may define a set of commands and constraints. The plugin runner contains the plugin definition and a mapping of command names to command callbacks and constraint names to constraint callbacks.
- Parameters:
plugin_definition (Definition)
command_to_callback (dict[str, Callable])
constraint_to_callback (dict[str, Callable])
- plugin_definition¶
The definition for the plugin.
- command_to_callback¶
Dictionary mapping command names to command callbacks.
- Type:
dict[str, Callable]
- constraint_to_callback¶
Dictionary mapping constraint names to constraint callbacks.
- Type:
dict[str, Callable]
- add_command_callback(command_name: str, command_callback: Callable) None [source]¶
Add a command callback to the plugin runner.
- Parameters:
command_name (str)
command_callback (Callable)
- Return type:
None
- add_constraint_callback(constraint_name: str, constraint_callback: Callable) None [source]¶
Add a constraint callback to the plugin runner.
- Parameters:
constraint_name (str)
constraint_callback (Callable)
- Return type:
None
- get_command_callback(command_name: str) Callable [source]¶
Return the callback for the given constraint name.
- Parameters:
command_name (str)
- Return type:
Callable