ccproxy.cli.decorators¶
ccproxy.cli.decorators
¶
CLI command decorators for plugin dependency management.
needs_auth_provider
¶
Decorator to mark CLI commands that need an auth provider.
This decorator marks the command as requiring the auth provider specified in the command arguments. The actual plugin loading is handled by the command implementation using load_cli_plugins().
Usage
@app.command() @needs_auth_provider() async def auth_status(provider: str): # Command implementation pass
Source code in ccproxy/cli/decorators.py
allows_plugins
¶
Decorator to specify additional plugins a CLI command can use.
This decorator specifies additional CLI-safe plugins that the command wants to use beyond the default set. These plugins must still be marked as cli_safe = True to be loaded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugin_names
|
list[str]
|
List of plugin names to allow (e.g., ["request_tracer", "metrics"]) |
required |
Usage
@app.command() @allows_plugins(["request_tracer", "metrics"]) async def my_command(): # Command implementation pass
Source code in ccproxy/cli/decorators.py
get_command_auth_provider
¶
Check if a command needs an auth provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Any]
|
Function to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the command is decorated with @needs_auth_provider() |