Commands
provide.foundation.cli.click.commands
¶
Click command building and integration.
Builds individual Click commands from CommandInfo objects and integrates them with Click groups.
Classes¶
Functions¶
add_command_to_group
¶
add_command_to_group(
info: CommandInfo,
groups: dict[str, Group],
root_group: Group,
registry: Registry,
) -> None
Build and add a Click command to the appropriate group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
CommandInfo
|
CommandInfo object for the command |
required |
groups
|
dict[str, Group]
|
Dictionary of existing groups |
required |
root_group
|
Group
|
Root group |
required |
registry
|
Registry
|
Command registry (unused, kept for signature compatibility during refactor) |
required |
Source code in provide/foundation/cli/click/commands.py
build_click_command_from_info
¶
Build a Click command directly from CommandInfo.
This is a pure builder function that creates a Click command from a CommandInfo object without requiring registry access. Supports typing.Annotated for explicit argument/option control.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
CommandInfo
|
CommandInfo object with command metadata |
required |
Returns:
| Type | Description |
|---|---|
Command
|
Click Command object |
Raises:
| Type | Description |
|---|---|
CLIBuildError
|
If command building fails |
Example
from provide.foundation.hub.info import CommandInfo info = CommandInfo(name="greet", func=greet_func, description="Greet someone") click_cmd = build_click_command_from_info(info) isinstance(click_cmd, click.Command) True