Adapter
provide.foundation.cli.click.adapter
¶
Click CLI adapter implementation.
Classes¶
ClickAdapter
¶
Click framework adapter.
Implements the CLIAdapter protocol for the Click framework, converting framework-agnostic CommandInfo objects to Click commands and groups.
Examples:
>>> adapter = ClickAdapter()
>>> command = adapter.build_command(command_info)
>>> isinstance(command, click.Command)
True
Functions¶
build_command
¶
Build Click command from CommandInfo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
CommandInfo
|
Framework-agnostic command information |
required |
Returns:
| Type | Description |
|---|---|
Command
|
Click Command object |
Raises:
| Type | Description |
|---|---|
CLIBuildError
|
If command building fails |
Source code in provide/foundation/cli/click/adapter.py
build_group
¶
build_group(
name: str,
commands: list[CommandInfo] | None = None,
registry: Registry | None = None,
**kwargs: Any
) -> click_types.Group
Build Click group with commands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Group name |
required |
commands
|
list[CommandInfo] | None
|
List of CommandInfo objects (or None to use registry) |
None
|
registry
|
Registry | None
|
Command registry |
None
|
**kwargs
|
Any
|
Additional Click Group options |
{}
|
Returns:
| Type | Description |
|---|---|
Group
|
Click Group object |
Raises:
| Type | Description |
|---|---|
CLIBuildError
|
If group building fails |